# Create user POST https://api-sandbox.payabli.com/api/User Content-Type: application/json Use this endpoint to add a new user to an organization. Reference: https://docs.payabli.com/developers/api-reference/user/add-user-to-an-organization ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Add User to an Organization version: endpoint_user.AddUser paths: /User: post: operationId: add-user summary: Add User to an Organization description: Use this endpoint to add a new user to an organization. tags: - - subpackage_user parameters: - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_user:AddUserResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/type_:UserData' components: schemas: type_:UsrAccess: type: object properties: roleLabel: type: string roleValue: type: boolean type_:AdditionalData: type: object additionalProperties: type: object additionalProperties: description: Any type type_:Email: type: string format: email type_:Language: type: string type_:MfaMode: type: integer type_:MfaData: type: object properties: mfa: type: boolean mfaMode: $ref: '#/components/schemas/type_:MfaMode' type_:NameUser: type: string type_:PhoneNumber: type: string type_:Orgid: type: integer format: int64 type_:Orgtype: type: integer type_:OrgScope: type: object properties: orgId: $ref: '#/components/schemas/type_:Orgid' orgType: $ref: '#/components/schemas/type_:Orgtype' type_:Timezone: type: integer type_:UsrStatus: type: integer type_:UserData: type: object properties: access: type: array items: $ref: '#/components/schemas/type_:UsrAccess' additionalData: $ref: '#/components/schemas/type_:AdditionalData' email: $ref: '#/components/schemas/type_:Email' description: The user's email address. language: $ref: '#/components/schemas/type_:Language' mfaData: $ref: '#/components/schemas/type_:MfaData' name: $ref: '#/components/schemas/type_:NameUser' phone: $ref: '#/components/schemas/type_:PhoneNumber' description: The user's phone number. pwd: type: string scope: type: array items: $ref: '#/components/schemas/type_:OrgScope' timeZone: $ref: '#/components/schemas/type_:Timezone' usrStatus: $ref: '#/components/schemas/type_:UsrStatus' type_:IsSuccess: type: boolean type_:ResponseText: type: string type_user:AddUserResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseData: type: string description: The response data. responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText ``` ## SDK Code Examples ```typescript import { PayabliClient, PayabliEnvironment } from "@payabli/sdk-node"; async function main() { const client = new PayabliClient({ environment: PayabliEnvironment.Sandbox, apiKey: "YOUR_API_KEY_HERE", }); await client.user.addUser({}); } main(); ``` ```python from payabli import payabli from payabli.environment import payabliEnvironment client = payabli( environment=payabliEnvironment.SANDBOX, api_key="YOUR_API_KEY_HERE" ) client.user.add_user() ``` ```csharp using PayabliApi; using System.Threading.Tasks; namespace Usage; public class Example { public async Task Do() { var client = new PayabliApiClient( apiKey: "YOUR_API_KEY_HERE", clientOptions: new ClientOptions { BaseUrl = PayabliApiEnvironment.Sandbox } ); await client.User.AddUserAsync( new UserData() ); } } ``` ```go package example import ( client "github.com/payabli/sdk-go/v/client" option "github.com/payabli/sdk-go/v/option" payabli "github.com/payabli/sdk-go/v" context "context" ) func do() { client := client.NewClient( option.WithBaseURL( payabli.Environments.Sandbox, ), option.WithApiKey( "YOUR_API_KEY_HERE", ), ) request := &payabli.UserData{} client.User.AddUser( context.TODO(), request, ) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/User") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/User") .header("requestToken", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api-sandbox.payabli.com/api/User', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/User")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```