[POST] .../v1/chat/add
Creates a new chat and adds participants. Use this method to create a standalone group, individual or channel chat before adding messages or managing participants. The request body is required; name, logo_url and external_id are optional strings, chat_type defaults to Group and participants can seed the initial membership or be omitted so the current request user is added automatically. The current request user must have chat add permission and the method returns the new chat UUID in new_id after the chat and participant rows are inserted. Missing body, invalid participant roles or entity identifiers, denied permission, duplicate or inconsistent individual chat data, linked storage errors and database failures are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| chat_type | String | Optional | Chat type to create: Group or Individual. If omitted, a Group chat is created. Allowed values: Default, Group, Individual, Channel. |
| external_id | String | Optional | External chat ID. Ignored for Individual chats. |
| logo_url | String | Optional | Chat logo URL. |
| name | String | Optional | Chat name. |
| participants | Array of ChatParticipantAddEdit | Optional | Initial chat participant list. If omitted, the chat creator is added automatically. |
Request Example
{
"name": "Purchase approval",
"external_id": "purchase-approval",
"chat_type": "Group",
"participants": [
{
"entity_type": "User",
"entity_id": 42,
"role": "Staff"
},
{
"entity_type": "User",
"entity_id": 64,
"role": "Member"
}
]
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert_uuid | Created UUID record result. |
Response Example
{
"ok": true,
"result": {
"new_id": "8cdd646d-dbd0-45c0-8f5b-d90a9b000001"
}
}