Create User API
Learn how to create a new user through the /v1/cl2c/user endpoint
The POST /v1/cl2c/user
API endpoint allows you to create a new user. This requires specifying essential user details such as firstName
, lastName
, email
, userName
, and phoneNumber
within the request body. Authentication headers including tenant
and X-API-Key
are required to ensure secure access.
Endpoint
POST
/v1/cl2c/user
Creates a new user with the provided details.
Parameters
Name | Type | Location | Required | Description |
---|---|---|---|---|
tenant | string | Header | Yes | Tenant ID for accessing this API. |
X-API-Key | string | Header | Yes | API Key ID for accessing this API. |
Request Body
Content Type: application/json
Example Request Body
{
"firstName": "string",
"lastName": "string",
"email": "string",
"userName": "string",
"phoneNumber": "string"
}
Schema
Field | Type | Description |
---|---|---|
firstName | string | The first name of the user. |
lastName | string | The last name of the user. |
string | User's email address. | |
userName | string | Unique username for the user. |
phoneNumber | string | Contact number of the user. |
Responses
Success (200)
Content Type: application/json
Example Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"userName": "string",
"firstName": "string",
"lastName": "string",
"email": "string",
"emailConfirmed": true,
"authenticated": true,
"authValidUpto": "2024-11-05T19:46:48.912Z",
"authLocation": "string",
"phoneNumber": "string",
"walletAddress": "string"
}
Error (400)
Content Type: application/json
Example Error Response
{
"type": "string",
"title": "string",
"status": 400,
"detail": "string",
"instance": "string",
"errors": {
"fieldName": ["Error message 1", "Error message 2"]
}
}
Code Samples
Usage in Different Frameworks
Node.js Example
const axios = require('axios');
axios.post('https://api.example.com/v1/cl2c/user', {
firstName: "John",
lastName: "Doe",
email: "john.doe@example.com",
userName: "johndoe",
phoneNumber: "+1234567890"
}, {
headers: {
'tenant': 'your-tenant-id',
'X-API-Key': 'your-api-key'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error.response.data));