Generate a new PubSub Token
POST/tokens
Generate a PubSub Token to be used to authenticate clients to the PubSub Service.
Permissions
The API token must include the following scopes: PubSub.
Request
- application/json
Body
required
The maximum time, in minutes, that the access token will be valid for. Between 1 and 43,200 (30 days).
15
channels
object
required
Each channel with write
and read
objects with boolean as values. Max of 500 channels inside main 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.
property name*
object
The key for this object represents the name of the channel. The inner properties specify its permissions.
true
false
The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.
John Doe
An arbitrary JSON object available to store stateful application information in. Must be valid JSON and have a maximum size of 2,000 characters.
{"display_name":"Joe","an_array":["foo","bar","baz"]}
Responses
- 200
- 422
OK
- application/json
- Schema
- Example (from schema)
Schema
A PubSub Token to be used to authenticate clients to the PubSub Service.
eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ
{
"token": "eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ"
}
Unprocessable Entity. You may have specified invalid parameters.
- application/json
- Schema
- Example (from schema)
Schema
{
"type": "validation_error",
"code": "not_a_valid_json",
"message": "Permissions must be valid JSON",
"attribute": "permissions",
"url": "https://developer.signalwire.com/rest/overview/error-codes/#not_a_valid_json"
}