---
title: Create user.
description: This can only be done by the logged in user.
url: "https://cbotai.shahrear.msf.bd/docs/create-user/"
updated: "2026-08-16"
category: Full setup / user
---

# Create user.

POST`/user`

## Code Samples

```curl

                curl --request POST \
  --url '/api/v3/user' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}'

                const response = await fetch('/api/v3/user', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
})
});

const data = await response.json();
console.log(data);

                import requests

headers = {
    "Content-Type": "application/json"
}

payload = {
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}

response = requests.post("/api/v3/user", headers=headers, json=payload)

print(response.json())

                <?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => '/api/v3/user',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
  'Content-Type: application/json'
  ],
  CURLOPT_POSTFIELDS => '{
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}',
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;

                using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "/api/v3/user");
request.Content = new StringContent(@"{
    ""id"": 10,
    ""username"": ""theUser"",
    ""firstName"": ""John"",
    ""lastName"": ""James"",
    ""email"": ""john@email.com"",
    ""password"": ""12345"",
    ""phone"": ""12345"",
    ""userStatus"": 1
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);

                import java.net.URI;
import java.net.http.*;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("/api/v3/user"))
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
{
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}
"""))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

This can only be done by the logged in user.

## Request Body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer (int64) | Optional |  |
| `username` | string | Optional |  |
| `firstName` | string | Optional |  |
| `lastName` | string | Optional |  |
| `email` | string | Optional |  |
| `password` | string | Optional |  |
| `phone` | string | Optional |  |
| `userStatus` | integer (int32) | Optional | User Status |

```json

                {
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}
```

## Responses

### 200 — successful operation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer (int64) | Optional |  |
| `username` | string | Optional |  |
| `firstName` | string | Optional |  |
| `lastName` | string | Optional |  |
| `email` | string | Optional |  |
| `password` | string | Optional |  |
| `phone` | string | Optional |  |
| `userStatus` | integer (int32) | Optional | User Status |

```json

                {
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}
```

### default — Unexpected error

## Response

```
200
{
    "id": 10,
    "username": "theUser",
    "firstName": "John",
    "lastName": "James",
    "email": "john@email.com",
    "password": "12345",
    "phone": "12345",
    "userStatus": 1
}
```
