> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tangerine365.com/llms.txt.
> For full documentation content, see https://docs.tangerine365.com/llms-full.txt.

# Single User Creation

POST https://localhost:8090//api/user/createuser
Content-Type: application/x-www-form-urlencoded

Create a single user account in the system.  
  
This endpoint accepts standard user fields like name, email, password, and role.  
  
It performs validation, assigns the user to the specified org unit, and returns the user details upon success.

Use this endpoint when creating one user at a time.

Reference: https://docs.tangerine365.com/tangerine-365-enterprise/single-user-creation

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Tangerine365 Enterprise
  version: 1.0.0
paths:
  //api/user/createuser:
    post:
      operationId: single-user-creation
      summary: Single User Creation
      description: >-
        Create a single user account in the system.  
          
        This endpoint accepts standard user fields like name, email, password,
        and role.  
          
        It performs validation, assigns the user to the specified org unit, and
        returns the user details upon success.


        Use this endpoint when creating one user at a time.
      tags:
        - ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Single User Creation_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                auth:
                  type: string
                role:
                  type: string
                  description: optional
                email:
                  type: string
                valid:
                  type: string
                  description: '0: suspended user; 1: active user'
                lastname:
                  type: string
                password:
                  type: string
                  description: >-
                    (if not specified password will be generated and sent to the
                    user)
                username:
                  type: string
                firstname:
                  type: string
              required:
                - auth
                - role
                - email
                - valid
                - lastname
                - password
                - username
                - firstname
servers:
  - url: https://localhost:8090
components:
  schemas:
    ApiUserCreateuserPostResponsesContentApplicationJsonSchemaUserdata:
      type: object
      properties:
        email:
          type: string
          format: email
        valid:
          type: string
        orgCode:
          description: Any type
        lastname:
          type: string
        username:
          type: string
        firstname:
          type: string
        lastenter:
          description: Any type
        tenant_id:
          type: string
        full_userid:
          type: string
        register_date:
          type: string
      required:
        - email
        - valid
        - lastname
        - username
        - firstname
        - tenant_id
        - full_userid
        - register_date
      title: ApiUserCreateuserPostResponsesContentApplicationJsonSchemaUserdata
    Single User Creation_Response_200:
      type: object
      properties:
        idst:
          type: integer
        message:
          type: string
        success:
          type: boolean
        userdata:
          $ref: >-
            #/components/schemas/ApiUserCreateuserPostResponsesContentApplicationJsonSchemaUserdata
      required:
        - idst
        - message
        - success
        - userdata
      title: Single User Creation_Response_200

```

## SDK Code Examples

```python Single User Creation_example
import requests

url = "https://localhost:8090//api/user/createuser"

payload = ""
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript Single User Creation_example
const url = 'https://localhost:8090//api/user/createuser';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: new URLSearchParams('')
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Single User Creation_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://localhost:8090//api/user/createuser"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Single User Creation_example
require 'uri'
require 'net/http'

url = URI("https://localhost:8090//api/user/createuser")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'

response = http.request(request)
puts response.read_body
```

```java Single User Creation_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://localhost:8090//api/user/createuser")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```php Single User Creation_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://localhost:8090//api/user/createuser', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
]);

echo $response->getBody();
```

```csharp Single User Creation_example
using RestSharp;

var client = new RestClient("https://localhost:8090//api/user/createuser");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift Single User Creation_example
import Foundation

let headers = ["Content-Type": "application/x-www-form-urlencoded"]

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:8090//api/user/createuser")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```