DocsGetting StartedAPI ReferenceCreate User

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

NameTypeLocationRequiredDescription
tenantstringHeaderYesTenant ID for accessing this API.
X-API-KeystringHeaderYesAPI 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

FieldTypeDescription
firstNamestringThe first name of the user.
lastNamestringThe last name of the user.
emailstringUser's email address.
userNamestringUnique username for the user.
phoneNumberstringContact 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));