Skip to main content

Create Users

Create up to 50 users in a single request: as SSO users, by registering them directly with a password, or by sending them an invitation email.

POST
/api/public/users

Headers​

KeyValue
Content-Typeapplication/json
AuthorizationBearer <Account API Key>

Modes​

auth_type selects how the users will sign in. Within the default password type, pre_register then selects whether a password is set for them or they are emailed an invitation.

ModeBehavior
auth_type: "sso"Users are created as SSO users and added to the given groups. They sign in through your identity provider. No password is set and no email is sent.
auth_type: "password" (or omitted) with pre_register: trueUsers are created and activated immediately with the supplied user_password and added to the given groups. No email is sent.
auth_type: "password" (or omitted) with pre_register: false (or omitted)Users receive an invitation email and set their own password from the activation link. They are added to the given groups on activation.
caution

Pre-registering users with preset passwords should only be used where invitation emails cannot be delivered. See Adding users to your account for guidance.

Request body​

FieldTypeDescription
auth_type (optional)String"sso" or "password". Default "password". Any other value returns 400.
pre_register (optional)BooleanSelects the mode described above. Default false. Ignored when auth_type is "sso".
invitee_user (required)Array1 to 50 user objects to create (see below).
admin_id (invite mode)IntegerUser id of the administrator sending the invitation.
admin_name (invite mode)StringName of the administrator, shown in the invitation email.

invitee_user object​

FieldTypeDescription
user_name (required)StringFull name of the user.
user_email (required)StringEmail address. Must not already exist in the account. In SSO mode the domain must belong to a configured identity provider.
user_group_name (required)Array of StringNames of existing groups to add the user to. Pass an empty array for none.
user_password (pre-register mode)StringInitial password for the user. Must not be sent when auth_type is "sso".

SSO mode​

With auth_type: "sso" each user is created as an SSO user — verified, active, with no password — and added to the groups you name. They can sign in through your identity provider straight away and already hold the right group memberships, so you can onboard everyone from your own admin application instead of using the Manage Users section of Studio.

Requirements and behavior:

  • SSO must be configured for the account. If no identity provider is configured, the whole request is rejected with 400, because the users created would otherwise be unable to sign in through any path.
  • Each user_email domain must match a domain on one of the configured identity providers — the same check the Manage Users screen applies. Users whose domain does not match are reported with error_code 8, and the rest of the batch is still processed.
  • user_password is rejected rather than ignored (error_code 9), so a caller never assumes a password was set when none exists.
  • Groups are given by name in user_group_name and must already exist. Create them under Users → Groups first — see Grouping users. Names that do not match an existing group are skipped.
  • No invitation email is sent. Nothing has to be delivered to the user for onboarding to complete.
info

SSO users created this way have no password at all, which is what keeps them on the identity provider for sign-in. If you need a user to sign in with a password instead, create them with auth_type: "password".

Example cURL​

Create SSO users with groups pre-assigned:

curl --location --request POST '<BUILDER_URL>/api/public/users' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXX' \
--data-raw '{
"auth_type": "sso",
"invitee_user": [
{
"user_name": "Jane Doe",
"user_email": "jane@example.com",
"user_group_name": ["Sales", "Support"]
},
{
"user_name": "John Smith",
"user_email": "john@example.com",
"user_group_name": ["Sales"]
}
]
}'

Pre-register a user:

curl --location --request POST '<BUILDER_URL>/api/public/users' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXX' \
--data-raw '{
"pre_register": true,
"invitee_user": [
{
"user_name": "Jane Doe",
"user_email": "jane@example.com",
"user_password": "Str0ngPassw0rd!",
"user_group_name": ["Sales", "Support"]
}
]
}'

Invite users by email:

curl --location --request POST '<BUILDER_URL>/api/public/users' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXX' \
--data-raw '{
"pre_register": false,
"admin_id": 1,
"admin_name": "Admin",
"invitee_user": [
{
"user_name": "Jane Doe",
"user_email": "jane@example.com",
"user_group_name": ["Sales"]
},
{
"user_name": "John Smith",
"user_email": "john@example.com",
"user_group_name": []
}
]
}'

Responses​

Status CodeDescriptionResponse
200Request processed. The body lists the users that could not be created; an empty array means every user was created.application/json
400auth_type is not sso or password, or auth_type is sso and the account has no identity provider configuredapplication/json
401Unauthorized, or invitee_user is emptyapplication/json
500Internal Server Errorapplication/json

Sample response​

200 : All users created

[]

200 : Some users could not be created

[
{
"user_email": "jane@example.com",
"error_code": "3",
"error_detail": "User already exists in the channel"
},
{
"user_email": "john@example.com",
"error_code": "6",
"error_detail": "Licence expired"
}
]

Error codes​

error_codeDescription
2Not a valid email address.
3A user with this email already exists in the account.
6The account's user licence has expired or no seats are available.
8SSO mode only. The email domain is not configured for SSO in this account.
9SSO mode only. user_password was supplied, which is not allowed for an SSO user.
10SSO mode only. The user could not be created as an SSO user — most often because the email already exists in another account, where the account-wide SSO setting cannot be changed for it.