Add member(s) to a channel

​

Adds one or more members to a standard channel. Upsert and idempotent: re-adding an existing member updates their claims and is not an error. Membership may precede any connection — the channel appears in each added user's inbox immediately.

Send either a single { userId, claims? } or a batch { members: [...] } (up to 100 members per request). claims is an optional display snapshot (for example username, avatar) recorded at add time; a row otherwise fills in when the user first connects.

claims is a display snapshot, not permissions — a session's capabilities come from the authz callback's allow(capabilities) verdict at connect, and nothing here grants them. Unknown fields (capabilities among them) are rejected with validation_failed rather than silently ignored.

Path Parameters

  • The channel id. Channels are not created explicitly — they exist by being used.

Body

required
application/json
  • Send a single member or a batch.

    Send a single member or a batch.

    • Optional display snapshot (for example username, avatar).

      Properties: 1

Responses

  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/v1/channels/{channelId}/members
curl https://api.useportal.co/v1/channels/chat-general/members \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "userId": "u_456",
  "claims": {
    "username": "grace"
  }
}'
Two members were added
{
  "added": 2
}