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 Admins

Overview

Add or remove group admins on an existing group conversation. Admins can manage group settings, permissions, and membership depending on your groupPermissions flags.

Set type to add or remove, and pass the affected chat user ids in the groupAdmins array. The response returns the updated conversation document.

When to use this endpoint?

Use Group Admins when:

  • A group owner promotes a member to admin from the SDK group settings screen.
  • You demote an admin back to a regular member (type: remove).
  • You batch-promote multiple members after a role change in your app.
  • You sync admin lists from an external workspace or org chart.

Part of the Chat Conversation APIs for the chat package / SDK — not Platform → Conversations. Requires a chat user Bearer token with sufficient group privileges (typically owner or existing admin).

Request Fields

FieldTypeRequiredDescription
conversationIdstringRequiredThe group conversation's _id.
typestringRequiredOperation to perform: add or remove.
groupAdminsstring[]RequiredChat user ids to promote (add) or demote (remove) as group admins. Users must already be participants when adding.
PATCH{baseUrl}/api/{apiVersion}/conversation/group/admins/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 admin or owner privileges on 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

Add admins — promote one or more participants:

json
{
  "conversationId": "694b...d8",
  "type": "add",
  "groupAdmins": [
    "694b...a1"
  ]
}

Remove admins — demote admins back to regular members:

json
{
  "conversationId": "694b...d8",
  "type": "remove",
  "groupAdmins": [
    "694b...a1"
  ]
}

Success Response (HTTP 200 OK)

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

json
{
  "success": true,
  "message": "Admins 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

Admin changes fail when the token is invalid, the conversation does not exist, the caller lacks admin 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 is not a group admin or owner, or cannot modify admins.
404 Not FoundNo group conversation matches conversationId.
400 Bad RequestInvalid type, empty groupAdmins, or user is not a participant.
500 Internal Server ErrorAn unexpected error occurred while updating admins.

Best Practices

  • Only promote users who are already in participants; add them first via Group Participants if needed.
  • Avoid removing the last admin unless transferring ownership — keep at least one admin for manageable groups.
  • Refresh the SDK group settings UI from data.conversation.groupAdmins after each successful PATCH.
  • Gate promote/demote actions in your UI based on the caller's role (owner vs admin) and your product rules.

Admins updated

Update the SDK admin badges and settings menu from the returned groupAdmins array. Adjust Group Permissions if admin capabilities should change alongside promotions.

PreviousCreate groupNextGroup permissions

On this page

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