Skip to main content
Create Group Conversation
Creates a group conversation. The caller is automatically added as an admin. All provided memberIds are validated to belong to the project and added as member. Send a JSON body, or multipart/form-data when uploading the group’s avatar with it. On a multipart request every field is a string: send memberIds and metadata as JSON strings.

Body Parameters

string
required
Must be "group".
string
Display name of the conversation. Maximum 200 characters. Optional.
string
Optional description for the conversation. Maximum 1000 characters.
string[]
Array of user IDs to add to the conversation. Defaults to []. The caller’s own ID is ignored if included — they are always added as admin. All IDs must belong to the same project.
object
Custom key-value data to attach to the conversation. Optional.
file
The group’s avatar image: JPEG, PNG or WebP, maximum 50 MB. Requires avatarFile.options. The image is processed into the variants the options ask for, and the conversation’s avatarFileId points at it. Requires the files-images bundle.
string
JSON-encoded image-processing options for avatarFile: a mode and the fields it needs, for example { "mode": "original-aspect", "sizes": { "small": 64, "large": 256 } }. See Image Processing Modes. A key the options don’t take, a key of another mode included (for example sizes with exact-dimensions), is refused with 400 chat/invalid-body, param naming it.
string
Service key only, and required with one: the user this request acts as. They create the group and become its admin. A user token always acts as its own user and must not send it (400 chat/acting-user-not-allowed).

Response

Returns the created Conversation object with HTTP 201. When the files-images bundle is installed it includes avatarFile: the avatar’s file, or null when the group was created without one.

Error Responses

Returned with no JSON body: 401 when no Authorization header is sent, 403 when the access token is invalid or expired. Checked before any uploaded file is read, so a request with no credentials gets 401 rather than a body or acting-user error.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token, or with no credentials:
The request sent avatarFileId. The avatar is the image itself, uploaded as avatarFile; this endpoint never takes the id of a file uploaded elsewhere.
A service key sent no actingUserId.
One or more provided user IDs do not exist in this project.
Returned when an avatar is uploaded on a project without the files-images bundle. missingTables lists the tables that aren’t installed and bundleId the bundle to install. While the bundle is still being installed, the response is 503 database/tables-provisioning instead. See Bundles.
The file can’t be read as an image.
An image over 10000 px on a side gets the same code. error gives its size:
avatarFile was uploaded without avatarFile.options.
avatarFile.options isn’t valid JSON, or isn’t valid image options.
avatarFile.options without mode, or with a mode that isn’t one of the five (other options fields the same way, named in error and param):
In an aspect-ratio mode, a variant’s computed side would be outside 1–10000 px. Checked once the image is read, before anything is stored. param names the option:
In aspect-ratio-height-based it names a heights option and gives a width. In multi-aspect-ratio it names a sizes option, and the ratio is the one in aspectRatios closest to the image, so the text reads ”… at the 3:1 aspect ratio, the one in aspectRatios closest to this image. Each side of a variant must be 1–10000 px.” More than 30 entries in dimensions, widths, heights or sizes (one variant each). param names the option:
A variant name that uses a character other than letters, digits, _, - and ., that is longer than 64 characters, that contains .., or that is original. param names the option:
A key the options don’t take (also a key of another mode). error names the object holding it, param the key itself:
A file was refused as the body was read: chat/unsupported-file-type or chat/unexpected-file-field (a file in another field, or a second file in avatarFile), with param naming the field when there is one. A body over 250 MB gets 413 request/body-too-large; one that can’t be read at all gets request/invalid-multipart or request/field-too-large. See Upload errors.