v77

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

Create PubSub token

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

Permissions

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

Learn more about API scopes.

post/api/pubsub/tokens

Request body

ttlinteger required

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

channelsPubSubPubSubChannels 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. 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.

statePubSubPubSubState

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": 15,
  "channels": {
    "channela": {
      "read": true,
      "write": false
    },
    "channelb": {
      "read": true
    }
  },
  "member_id": "John Doe",
  "state": {
    "display_name": "Joe",
    "an_array": [
      "foo",
      "bar",
      "baz"
    ]
  }
}

Response

The request has succeeded.

tokenstring required

A PubSub Token to be used to authenticate clients to the PubSub Service.

Example response

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