# Add user

**Endpoint**

`POST/v2/user`

**Link**

{% embed url="<https://stagep.tst-apidmndelss.com/openapi/v2.html#/operations/Users_Add>" %}

The newly created user will typically start with a `NEW` status and may require further verification or moderation depending on system configuration.

### **Request**

#### **Authentication**

An API key is required for authentication. Include it in the `Authorization` header.

* **Header:** `Authorization`
* **Value:** Your API key token

#### **HTTP Method & URL**

* **Method:** `POST`
* **URL:** `https://stagep.tst-apidmndelss.com/v2/user`

#### **Headers**

| Key             | Value              | Required |
| --------------- | ------------------ | -------- |
| `Authorization` | `Bearer <JWT>`     | Yes      |
| `Accept`        | `application/json` | Yes      |
| `Content-Type`  | `application/json` | Yes      |

#### **Request Body (JSON)**

All fields should be sent as a JSON object in the request body.

| Field            | Type     | Description                         | Required | Example                |
| ---------------- | -------- | ----------------------------------- | -------- | ---------------------- |
| **`username`**   | `string` | **User's login identifier**.        | Yes      | `john.smith`           |
| **`password`**   | `string` | **User's login password**.          | Yes      | `SecurePass123!`       |
| **`customerId`** | `string` | **Associated customer identifier**. | No       | `cust_abc123`          |
| **`name`**       | `string` | **User's first name**.              | No       | `John`                 |
| **`lastname`**   | `string` | **User's last name**.               | No       | `Smith`                |
| **`comment`**    | `string` | **Administrative comments**.        | No       | `VIP customer account` |

**Example Request Body:**

```json
{
  "customerId": "cust_abc123",
  "username": "john.smith",
  "password": "SecurePass123!",
  "name": "John",
  "lastname": "Smith",
  "comment": "VIP customer account"
}
```

***

### **Response (200 OK)**

Returns the newly created user object with system-generated fields and default status.

#### **Response Fields**

**User Object (`item`)**

| Field          | Type      | Description                          | Example                |
| -------------- | --------- | ------------------------------------ | ---------------------- |
| **`uuid`**     | `string`  | **System-generated unique user ID**. | `user_7d83h2k9`        |
| **`username`** | `string`  | **User's login name**.               | `john.smith`           |
| **`status`**   | `string`  | **Initial account status**.          | `NEW`                  |
| **`is2fa`**    | `boolean` | **2FA enabled status**.              | `false`                |
| **`createAt`** | `string`  | **Account creation timestamp**.      | `2024-01-15T10:30:00Z` |
| **`updateAt`** | `string`  | **Last update timestamp**.           | `2024-01-15T10:30:00Z` |
| **`name`**     | `string`  | **User's full name**.                | `John Smith`           |
| **`comment`**  | `string`  | **Administrative comments**.         | `VIP customer account` |

**Example Response:**

```json
{
  "item": {
    "uuid": "user_7d83h2k9",
    "username": "john.smith",
    "status": "NEW",
    "is2fa": false,
    "createAt": "2024-01-15T10:30:00Z",
    "updateAt": "2024-01-15T10:30:00Z",
    "name": "John Smith",
    "comment": "VIP customer account"
  }
}
```

***

### **Examples**

#### **Basic User Creation Request (cURL)**

```bash
curl --request POST \
  --url https://stagep.tst-apidmndelss.com/v2/user \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer eyJhbGci...wNLGA' \
  --header 'Content-Type: application/json' \
  --data '{
    "username": "jane.doe",
    "password": "SecurePass456!",
    "name": "Jane",
    "lastname": "Doe"
  }'
```

#### **Complete User Creation with Customer ID**

```bash
curl --request POST \
  --url https://stagep.tst-apidmndelss.com/v2/user \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer eyJhbGci...wNLGA' \
  --header 'Content-Type: application/json' \
  --data '{
    "customerId": "cust_789xyz",
    "username": "robert.wilson",
    "password": "RobertPass789!",
    "name": "Robert",
    "lastname": "Wilson",
    "comment": "Enterprise account - priority support"
  }'
```

***

### **Error Responses**

1. **Missing Required Fields**:

   ```json
   { "error": "Missing required field: username" }
   ```
2. **Username Already Exists**:

   ```json
   { "error": "Username already exists: john.smith" }
   ```
3. **Invalid Password Format**:

   ```json
   { "error": "Password does not meet complexity requirements" }
   ```
4. **Unauthorized**:

   ```json
   { "error": "Unauthorized" }
   ```
5. **Customer Not Found**:

   ```json
   { "error": "Customer not found: cust_invalid_id" }
   ```

***

### **Notes**

#### **Password Requirements**

* Minimum length (typically 8-12 characters)
* Requires uppercase and lowercase letters
* Requires numbers and/or special characters
* Cannot contain username or common patterns

#### **Status Workflow**

* New users typically start with `NEW` status
* Status may automatically progress to `READY_FOR_MODERATION` or `VERIFY` based on system rules
* Additional verification steps may be required depending on configuration

#### **Best Practices**

* Use strong, unique passwords for each account
* Include both first and last names for better user identification
* Associate users with customer accounts when appropriate
* Use comments for administrative notes or special instructions

**Common Use Cases**:

* Onboarding new customers programmatically
* Bulk user registration for enterprise clients
* Automated account creation workflows
* Integration with CRM or user management systems

**Next Steps After Creation**:

* User may need to complete email verification
* Additional profile information may need to be added
* Status may require manual moderation/approval
* 2FA setup may be required for certain account types

Request sample

```
Authorization:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE2NCwiZXhwIjoxNzYxNTU3MjQ4LCJrZXkiOiI1Y2ZiOGZjN2RmYjk4ZjVkYmIyZTgwNTVkZWFhN2U2Zjk4MzEyYmE3Iiwib3RwX3ZlcmlmaWVkIjpmYWxzZX0.aCky2QDHayg1KQkIzYlUaZB5_IaYya7pZfWqNENi_7M
```

```postman_json
{
  "customerId": "D7k3xbc-ERrj-lde9k1t3XuaE",
  "username": "testapi@delos.financial",
  "password": "testapipassword",
  "name": "testapi@delos.financial",
  "lastname": "testapi@delos.financial",
  "comment": "testapi"
}
```

Response sample

200 OK

```postman_json
{
  "item": {
    "userId": "fc0206c3-f996-47a7-9695-9ea7947dfae8",
    "username": "testapi@delos.financial",
    "status": "NEW",
    "is2fa": false,
    "createAt": "2025-10-27T13:32:57Z",
    "updateAt": "2025-10-27T13:32:57Z",
    "name": "testapi@delos.financial",
    "comment": "testapi"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.delos.financial/users/add-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
