Create a user

POST
/api/users
Creates a new user by specifying either a password, verified email address or phone number. Along with the required identifiers, you can also provide additional user profile information, such as the user's given name and last name.

Body Parameters

username
string
Nullable

The unique username for the user.

email
string
Nullable

The user's email address.

email_verified
boolean
Nullable

Indicates whether the user's email address is verified.

Default:
false
phone_number
string
Nullable

The user's phone number, starting with a `+` followed by the country code.

phone_number_verified
boolean
Nullable

Indicates whether the user's phone number is verified.

password
string
Nullable

The password for the user, which will be used for authentication.

password_hash
string
Nullable

The password hash for the user, which will be used for authentication.

password_hash_algorithm
enum

The algorithm used the hash the password for the user.

Allowed Values:
b_crypt
is_temporary_password
boolean

Specifies whether the specified password is temporary and will require the user to reset their password on the next sign-in.

Default:
true
name
string
Nullable

The user's full name.

given_name
string
Nullable

The user's given (first) name.

middle_name
string
Nullable

The user's middle name or initial.

family_name
string
Nullable

The user's family (last) name.

nickname
string
Nullable

The user's preferred nickname.

picture
string
Nullable

The URI pointing to the user's profile picture.

skip_password_policy_checks
boolean

Specifies whether the password policy check should be skipped.

Default:
false
skip_identifier_restriction_checks
boolean

Specifies whether the identifier restriction checks should be skipped.

Default:
false
skip_conformance_checks
boolean

Specifies whether the users profile should conform to the options requirements.

Default:
false

Authentication

API-Key
header
Required

The API key is essential for accessing MonoCloud's APIs. You can find it in the Tenant Settings section of your MonoCloud dashboard. To authenticate your requests, include this key in the request header using the following format: X-API-Key: <Your_API_Key>.

Headers

content-type
string
  • application/json
accept
string
  • application/json
  • application/problem+json

Responses

201
Successfully created the user
400
Bad Request
422
Client Error
401
Unauthorized
403
Forbidden

Request Example

Request
curl -X POST "https://<your-domain>/api/users" \
 -H "X-API-KEY: <your-api-key>" \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 --data-raw '{
  "email_verified" : true,
  "skip_conformance_checks" : false,
  "phone_number_verified" : true,
  "given_name" : "John",
  "middle_name" : "S",
  "password_hash_algorithm" : "bcrypt",
  "is_temporary_password" : true,
  "picture" : "https://example.com/image.png",
  "password" : "SuperStrongPass12345!!!",
  "password_hash" : "$2a$12$LJdMf15uRsDpd57LKCGxSOTec3MD6jsgJhxRxCeSj2ZKobGo2xPDS",
  "name" : "John Doe",
  "nickname" : "Joey",
  "phone_number" : "+919988776655",
  "skip_identifier_restriction_checks" : false,
  "family_name" : "Smith",
  "email" : "johndoe@example.com",
  "username" : "johndoe",
  "skip_password_policy_checks" : false
}'

Response Example

Response
201 Created
{
  "creation_time": 1640975400,
"passkeys": [
{ "public_key": "MIICYzCCAcygAwIBAgIBADAMQwwCgYDVQBgQD2bZEoZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMB6Vf1nYi/rO+ryMO", "backup_state": true, "user_present": true, "backup_eligibility": true, "aa_guid": "204a871f-f7c4-465c-a81f-83d7ad4d04ee", "name": "IPhone 15 Pro Max", "passkey_id": "sM5X24vn_R3YqFvk8o5Hf7l3E1fMeyKnssiAgCYxouA", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0", "user_verified": true
}
], "last_known_city": "New York",
"private_data": {
"transaction_ids": [ "5GRZ4X7XUItpRGOwkHhONqTtG", "9Fw7Jx9Zja5lWlmRkYJf1WMV9"
], "subscription_plan": "premium", "last_renewed": 1672511400
}, "last_sign_in_success_ip": "1.1.1.1", "last_sign_in_attempt": 1640975400,
"emails": [
{ "verification_source": "monocloud", "verified": true, "id": "6cec8047-6149-4d9b-8d99-91c83c22a9dc", "source": "monocloud", "email": "user@example.com", "primary": false
}
], "last_activity": 1640975400, "password_updated_at": 1640975400,
"public_data": {
"color_preference": { "dashboard": "monochrome"
}, "send_emails": true, "days_to_retain": 1
}, "disabled": true,
"connections": [
{ "idp": "monocloud", "connection_id": "UOtBaOybB6dTpIJNrnkRw"
}
], "has_password": true, "last_updated": 1640975400, "last_sign_in_attempt_ip": "1.1.1.1", "block_until": 1640975400, "failure_count": 5, "last_known_country": "United States",
"phone_numbers": [
{ "verification_source": "monocloud", "phone": "+441514960453", "verified": true, "id": "ab66b6a2-df6b-4f9d-9eb2-5a7142984e70", "source": "monocloud", "primary": false
}
], "user_id": "UOtBaOybB6dTpIJNrnkRw", "force_password_reset": false, "sign_in_attempts_count": 20, "last_sign_in_success": 1640975400,
"claims": { "name": "John Doe", "given_name": "John", "family_name": "Doe"
}, "sign_in_success_count": 7, "last_known_region": "US",
"external_providers": [
{ "provider_user_id": "79a500f9-aba6-4f03-baec-c18f4b7136ad",
"claims": { "email": "user@example.com", "email_verified": "true", "name": "John Doe"
}, "authenticator": "google"
}
],
"username": { "id": "9082b772-dbf6-4610-a71e-05fb93c0ab73", "source": "monocloud", "username": "username"
} }