Skip to content

Create a sub-user

post/sub-users
Workspace key

Create a new sub-user for your company. Sub-users can log in to a branded portal on your custom domain and access their assigned chatbots.

Requires the SSO Login add-on (see plans) and a workspace API key; without the add-on, or with a chatbot-scoped key, the request gets a 403.

Your workspace's SSO company must exist and have a login domain before you can create sub-users. The sub-user's email must be unique within the company. Creating a sub-user sends no email.

Request body

Sending 2 of 7 fields
Required
emailstring
The sub-user's email address, stored in lowercase. It must be unique within the company, and for a sub-user without a password (who signs in by magic link) the mailbox must accept mail.
chatbotIdsarray of string
Array of chatbot IDs to assign to this sub-user. All IDs must belong to chatbots in your workspace. Duplicates are automatically removed.

Only these fields are sent (application/json).

Try it · POST /sub-users
curl 'https://api.chat-data.com/api/v2/sub-users' \  -H "Authorization: Bearer $CHAT_DATA_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "email": "[email protected]",  "chatbotIds": [    "6650f1c2a9e4b83d2c7a1f05",    "6650f1c2a9e4b83d2c7a1f06"  ]}'
Loading…

Responses

Sub-user created successfully.

Content type: application/json

FieldDescription
_idstringThe unique identifier of the sub-user.
companystringThe ID of the company this sub-user belongs to.
emailstringThe sub-user's email address.
namestringThe sub-user's display name.
avatarstringURL of the sub-user's avatar image, or an empty string if none is set.
chatbotIdsarray of objectThe assigned chatbots, each with its _id and name.
chatbotIds[]._idstringThe chatbot ID.
chatbotIds[].namestringThe chatbot name.
permissionsarray of stringPermissions granted to this sub-user.
analyticsDashboardSectionsarray of stringAnalytics dashboard sections visible to this sub-user.
hasPasswordbooleanWhether the sub-user has a password configured (the actual password is never returned).
hasGooglebooleanWhether the sub-user has signed in with a linked Google account (the Google ID is never returned). It stays false when Google sign-in is only enabled.
createdAtstringTimestamp when the sub-user was created.
lastLoginAtstringTimestamp of the sub-user's last sign-in. Absent until they first sign in.

Example

{  "_id": "6650f1c2a9e4b83d2c7a1f9a",  "company": "6650f1c2a9e4b83d2c7a1f3c",  "email": "[email protected]",  "name": "Jane Doe",  "avatar": "",  "chatbotIds": [    {      "_id": "6650f1c2a9e4b83d2c7a1f05",      "name": "Support Bot"    },    {      "_id": "6650f1c2a9e4b83d2c7a1f06",      "name": "Sales Assistant"    }  ],  "permissions": [    "read",    "train"  ],  "analyticsDashboardSections": [    "Overview",    "Messages Timeline",    "Chats"  ],  "hasPassword": true,  "hasGoogle": false,  "createdAt": "2026-10-14T09:30:00.000Z"}

Last updated October 14, 2026