Add User API

Learn how to create and manage CleverTap users using the SCIM Users API.

Overview

Adds a new user to one or more CleverTap accounts. If the user already exists in any of the accounts specified in the POST request, the request fails with an error message indicating that the user already exists. Only add users to accounts where they are not already present.

HTTP Method

POST

Endpoint

/nx/v2/scim/v2/Users

Base URL

The following is an example base URL for a CleverTap account in the United States region:

https://<clevertap_domain>/nx/v2/scim/v2/Users

Example: https://us1.dashboard.clevertap.com/nx/v2/scim/v2/Users

🚧

Region-Specific

The CleverTap domain is environment- and region-specific. Do not copy the example URL directly. Always replace <clevertap_domain> with the domain for your region. Refer Region for more details.

Headers

The following headers are required for every request.

HeaderDescriptionRequired
Content-TypeContent type of the request payload. Must be application/scim+jsonYes
AuthorizationBearer <SCIM_TOKEN>Yes

Replace <SCIM_TOKEN> with a valid SCIM Bearer token generated from the CleverTap dashboard. Refer to Generate SCIM Token for API-Based Provisioning.

Example Request

The following is the sample request:

curl -X POST https://<clevertap_domain>/nx/v2/scim/v2/Users
-H "Authorization: Bearer <SCIM_TOKEN>"
-H "Content-Type: application/scim+json"
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "[email protected]",
  "name": {
    "givenName": "Jane",
    "familyName": "Smith"
  },
  "active": true,
  "invitedBy": "[email protected]",
  "accounts": [
    {
      "accountId": "CLEVERTAP_ACCOUNT_ID",
      "roles": "Editor",
      "teams": "Marketing",
      "status": "Active"
    }
  ]
}

Request Parameters

The following table lists the request body parameters.

ParameterTypeRequiredDescription
schemasArray of StringNoSCIM schema identifiers. Must include urn:ietf:params:scim:schemas:core:2.0:User.
userNameStringNoUser’s email address.
nameObjectYesContains the user’s name attributes.
name.givenNameStringYesSpecifies the user’s first name.
name.familyNameStringYesSpecifies the user’s last name.
activeBooleanYesIndicates whether the user account is active. Must be set to true in POST requests.
invitedByStringYesEmail address of the user who invited this user. The inviter must be an admin.
accountsList (Object)YesContains account-level associations for the user. This field is required; the request will fail if omitted.
accounts.accountIdStringYesSpecifies the CleverTap account identifier associated with the user.
accounts.rolesStringYesComma-separated list of role names assigned to the user for the account.
accounts.teamsStringConditionalComma-separated list of team names the user belongs to for the account. Required only if your organization uses the Teams feature.
accounts.statusStringYesSpecifies the user’s access status for the account. Supported values: Active, Delete, and Revoke.

Notes

  • You must use valid team names and roles.
  • At least one account entry must include a status set to Active.
  • The user specified in invitedBy must have admin permissions.
  • Multiple accounts may be included only when they belong to the same parent-child structure.
  • Validation is strictly applied for email, account information, roles, and teams.

Example Response

The following is the sample response:

{
  "id": "user-unique-id",
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "userName": "[email protected]",
  "name": {
    "givenName": "Jane",
    "familyName": "Smith"
  },
  "active": true,
  "accounts": [
    {
      "accountId": "CLEVERTAP_ACCOUNT_ID",
      "roles": "Editor",
      "teams": "Marketing",
      "status": "Active"
    }
  ],
  "invitedBy": "[email protected]"
}

Response Parameters

The following table lists the response parameters.

ParameterTypeDescription
idStringSpecifies the unique identifier of the user generated by the system.
schemasArray of StringSCIM schema identifiers. Must include urn:ietf:params:scim:schemas:core:2.0:User.
userNameStringUser’s email address.
nameObjectContains the user’s name attributes.
name.givenNameStringSpecifies the user’s first name.
name.familyNameStringSpecifies the user’s last name.
activeBooleanIndicates whether the user account is active.
accountsList (Object)Contains account-level roles, teams, and status assignments for the user.
accounts.accountIdStringSpecifies the CleverTap account identifier associated with the user.
accounts.rolesStringSpecifies the role assigned to the user for the account.
accounts.teamsStringSpecifies the team to which the user belongs for the account.
accounts.statusStringSpecifies the user’s access status for the account.
invitedByStringSpecifies the email address of the user who invited this user.

Error Codes

The following table lists possible error responses.

Error CodeDescriptionSample Payload
400active is set to falsejson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "active: User must be active for provisioning", "status": 400 }
400name object is missingjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "name: Cannot be null", "status": 400 }
400givenName or familyName is missing or emptyjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "givenName: Cannot be empty, familyName: Cannot be empty", "status": 400 }
400accounts is missingjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account: Cannot be null", "status": 400 }
400accounts array is emptyjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account: Cannot be empty", "status": 400 }
400Invalid accountId providedjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].accountId: Invalid account", "status": 400 }
400roles not provided or emptyjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].roles: Cannot be empty", "status": 400 }
400One or more role names are invalid.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].roles: Invalid role names present: Creator1", "status": 400 }
400teams passed but Teams feature is not enabled.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].teams: Teams are not enabled for this account. Please remove teams from payload", "status": 400 }
400status not passed or empty.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].status: Cannot be empty", "status": 400 }
400Invalid status valuejson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "account[ACC123].status: Invalid status", "status": 400 }
400No account has status Activejson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "General: At least one account must have Active status", "status": 400 }
400invitedBy is missing or emptyjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "General: Invited by user cannot be empty", "status": 400 }
400One or more teams do not exist.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "Invalid teams: team4, team5 do not exist", "status": 400 }
401Missing or invalid authentication tokenjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "Authentication failed: Invalid or missing bearer token", "status": 401 }
403invitedBy user does not have Admin permissions.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "General: User does not have admin permissions to invite user", "status": 403 }
409User already exists in one or more accounts.json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "User already exists in accounts: ACC123", "status": 409 }
429Rate limit exceededjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "Rate limit exceeded. Please retry after 60 seconds", "status": 429 }
500Internal server errorjson { "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"], "detail": "An internal error occurred. Please contact support", "status": 500 }