v77

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-08-012528701.8 MB
Chat Tokens

Create chat token

Generate a Chat Token to be used to authenticate clients to the Chat Service.

Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: Chat.

Learn more about API scopes.

post/api/chat/tokens

Request body

ttlinteger required

The maximum time, in minutes, that the access token will be valid for. Between 1 and 43,200 (30 days).

channelsChatChatChannel required

User-defined channel names. Each channel is an object with read and/or write properties. Max of 500 channels. Either read, write, or both are required inside each channel and default to false. Each channel name can be up to 250 characters. Channel names cannot start with the reserved prefix sw_. Must be valid JSON.

member_idstring

The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.

stateChatChatState

An arbitrary JSON object available to store stateful application information in. Must be valid JSON and have a maximum size of 2,000 characters.

Example request

{
  "ttl": 60,
  "channels": {
    "channel1": {
      "read": true,
      "write": true
    },
    "channel2": {
      "read": true,
      "write": false
    }
  },
  "member_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "state": {
    "key": "value",
    "key2": "value2"
  }
}

Response

The request has succeeded.

tokenstring required

The generated Chat Token.

Example response

{
  "token": "eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ"
}