RealTimeX
Start For Free

RealTimeX

API Documentation

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

API Reference

Group Participants

Overview

Add or remove participants on an existing group conversation. Set type to add or remove, and pass chat user ids in the participants array.

Who may add or remove members depends on groupPermissions.allowMemberAdd and allowMemberRemove — admins can typically manage membership regardless. The response returns the updated conversation document.

When to use this endpoint?

Use Group Participants when:

  • A user adds contacts from the SDK people picker to an existing group.
  • An admin or permitted member removes someone from the group.
  • You sync membership after an org change (new hire joins the project channel).
  • A user leaves the group (remove their own id with type: remove if your app supports self-removal).

Part of the Chat Conversation APIs for the chat package / SDK — not Platform → Conversations. Requires a chat user Bearer token with permission to modify membership on the group.

Request Fields

FieldTypeRequiredDescription
conversationIdstringRequiredThe group conversation's _id.
typestringRequiredOperation to perform: add or remove.
participantsstring[]RequiredChat user ids to add to or remove from the group. For add, users need not already be in the conversation.
PATCH{baseUrl}/api/{apiVersion}/conversation/group/participants/add-remove

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 a participant with permission to add or remove members.
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

Add participants — invite users from the people picker:

json
{
  "conversationId": "694b...d8",
  "type": "add",
  "participants": [
    "694b...a4",
    "694b...a5"
  ]
}

Remove participants — remove one or more members from the group:

json
{
  "conversationId": "694b...d8",
  "type": "remove",
  "participants": [
    "694b...a4"
  ]
}

Success Response (HTTP 200 OK)

On success, data.conversation.participants reflects the updated membership. The success message varies by operation (for example "Members added successfully").

json
{
  "success": true,
  "message": "Members added 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": [],
      "lastMessage": "70a1...c4",
      "metadata": {
        "workspaceId": "c1"
      },
      "createdAt": "2026-07-10T09:00:00.000Z",
      "updatedAt": "2026-07-10T09:00:00.000Z"
    }
  },
  "error": null
}

Common Errors

Participant changes fail when the token is invalid, the conversation is missing, the caller lacks membership privileges, or the payload is malformed.

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 404 Not Found — Conversation missing

json
{
  "success": false,
  "message": "Conversation not found",
  "data": null,
  "error": null
}

HTTP 400 Bad Request — Invalid type or empty list

json
{
  "success": false,
  "message": "type must be add or remove",
  "data": null,
  "error": null
}
CodeReason
401 UnauthorizedChat user token is missing, invalid, or expired.
403 ForbiddenCaller cannot add/remove members per role or groupPermissions flags.
404 Not FoundNo group conversation matches conversationId.
400 Bad RequestInvalid type, empty participants, or user already in/not in the group.
500 Internal Server ErrorAn unexpected error occurred while updating participants.

Best Practices

  • Respect allowMemberAdd and allowMemberRemove before showing people-picker or remove actions to non-admins.
  • After adding members, notify them via your app or rely on SDK realtime updates so new participants see the thread.
  • When removing the group owner, transfer ownership or demote via Group Admins first according to your product rules.
  • Batch multiple ids in one request when inviting several people from the picker to reduce round trips.

Participants updated

Refresh the SDK member list from data.conversation.participants. Newly added users can open the group thread immediately; removed users should be routed out of the conversation view.

PreviousGroup informationNextList

On this page

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