RealTimeX
Start For Free

RealTimeX

API Documentation

IntroductionAuthenticationBase URLHeadersError codes
ListGet infoAttachmentsAttachments summaryCreate groupGroup adminsGroup permissionsGroup informationGroup participants
Sample requestsSample responsesStatus codesAppendixChangelog

API Reference

Create Group Conversation

Overview

Create a new group conversation in your chat app. The creator becomes the group owner and first admin; selected participants are added alongside them. You can set the group name, description, avatar, permission flags, and optional metadata in a single request.

On success, data.conversation is the full group document — use its _id to open the thread in the SDK, send messages, or manage members later.

When to use this endpoint?

Use Create Group Conversation when:

  • A user taps "New group" in the chat SDK and picks contacts from the people picker.
  • You need a multi-participant thread (team channel, project room, support desk group).
  • You want to seed default permission flags (groupPermissions) at creation time.
  • You attach app-specific context in metadata (workspace id, external room id, and so on).

Part of the Chat Conversation APIs for the chat package / SDK — not Platform → Conversations. Requires a signed-in chat user Bearer token, not a Platform client Access Token.

Workflow

  1. 1

    Pick participants

    In the chat SDK people picker, select chat user ids to include in the new group (excluding the creator, who is added automatically).

  2. 2

    Set group details

    Collect groupName, optional description, avatar URL, permissions, and any metadata your app needs.

  3. 3

    Create the group

    POST the payload with tenant headers and the signed-in chat user Bearer token. The API returns the full group conversation document.

Request Fields

FieldTypeRequiredDescription
participantsstring[]RequiredChat user ids to add to the group (excluding the creator, who is added automatically as owner and admin).
groupNamestringRequiredDisplay name shown in the SDK conversation list and group header.
creatorstringRequiredChat user id of the person creating the group. Becomes owner and is included in groupAdmins.
groupDescriptionstringOptionalShort description shown in group info screens.
groupImagestringOptionalURL for the group avatar image.
groupPermissionsobjectOptionalPermission flags for messaging, editing, and membership. See Group Permissions for each flag.
metadataobjectOptionalArbitrary key-value map for app-specific attributes.
POST{baseUrl}/api/{apiVersion}/conversation/group/create

Authentication

Required (Bearer token)

Tenant-scoped

Yes (tenant DB — requires x-client-id)

Request Headers

HeaderValueDescription
AuthorizationBearer <chat_user_token>Chat user Bearer token for the signed-in participant creating the group.
is-tenanttrueTargets the tenant DB ("true", needs x-client-id).
x-client-id{{clientId}}Tenant (client) id. Required when is-tenant=true.
Content-Typeapplication/jsonJSON request body.

Request Payload

Example creating a Dev Team group with two participants, a creator, default permissions, and workspace metadata:

json
{
  "participants": [
    "694b...a1",
    "694b...a2"
  ],
  "groupName": "Dev Team",
  "creator": "694b...a3",
  "groupDescription": "Sprint coordination",
  "groupImage": "https://cdn.example.com/group.png",
  "groupPermissions": {
    "onlyAdminCanSendMessage": false,
    "onlyAdminCanEditInfo": false,
    "senderCanEditMessage": true,
    "allowMemberAdd": true,
    "allowMemberRemove": false,
    "moderationEnabled": false
  },
  "metadata": {
    "workspaceId": "c1"
  }
}

Success Response (HTTP 200 OK)

On success, the API returns the created group conversation. The creator is included in participants and groupAdmins, and set as owner.

json
{
  "success": true,
  "message": "Group conversation created successfully",
  "data": {
    "conversation": {
      "_id": "694b...d8",
      "conversationType": "group",
      "groupName": "Dev Team",
      "groupDescription": "Sprint coordination",
      "groupImage": null,
      "participants": [
        "694b...a1",
        "694b...a2",
        "694b...a3"
      ],
      "groupAdmins": [
        "694b...a3"
      ],
      "owner": "694b...a3",
      "groupPermissions": {
        "onlyAdminCanSendMessage": false,
        "onlyAdminCanEditInfo": false,
        "senderCanEditMessage": true,
        "allowMemberAdd": true,
        "allowMemberRemove": false,
        "moderationEnabled": false
      },
      "unreadCount": {},
      "pinnedMessage": [],
      "isArchived": false,
      "lastMessage": "70a1...c4",
      "metadata": {
        "workspaceId": "c1"
      },
      "createdAt": "2026-07-10T09:00:00.000Z",
      "updatedAt": "2026-07-10T09:00:00.000Z"
    }
  },
  "error": null
}

Common Errors

Create fails when the chat user token is missing or invalid, required fields are absent, or the caller lacks permission to create groups.

HTTP 401 Unauthorized — No token

json
{
  "success": false,
  "message": "No token, authorization denied",
  "data": null,
  "error": "Unauthorized"
}

HTTP 403 Forbidden — Insufficient permissions

json
{
  "success": false,
  "message": "Access denied: insufficient permissions",
  "data": null,
  "error": null
}

HTTP 400 Bad Request — Missing required fields

json
{
  "success": false,
  "message": "participants and groupName are required",
  "data": null,
  "error": null
}
CodeReason
401 UnauthorizedChat user token is missing, invalid, or expired.
403 ForbiddenCaller is not allowed to create group conversations.
400 Bad RequestMissing participants, groupName, or creator; invalid user ids.
500 Internal Server ErrorAn unexpected error occurred while creating the group.

Best Practices

  • Pass the signed-in user's id as creator — do not rely on the token alone to infer ownership.
  • Exclude the creator from participants to avoid duplicate entries; the API adds them automatically.
  • Set sensible default groupPermissions at create time so the SDK UI matches your product rules from the first message.
  • Store the returned conversation._id in your chat state and navigate the SDK to that thread immediately after create.

Group created

Open the new thread in the chat SDK using data.conversation._id. Use Group Participants or Group Admins to adjust membership after creation.

PreviousAttachments summaryNextGroup admins

On this page

OverviewWhen to use this endpoint?WorkflowRequest FieldsRequest HeadersRequest PayloadSuccess ResponseCommon ErrorsBest Practices