Generate a new Chat Token
POST/tokens
Generate a Chat Token to be used to authenticate clients to the Chat Service.
Permissions
The API token must include the following scopes: Chat
.
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).
Possible values: >= 1
and <= 43200
60
channels
object
required
User-defined channel names. Each channel is a object with read
and write
properties.
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
Gives the token read access to the channel.
true
Gives the token write access to the channel.
false
The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.
3fa85f64-5717-4562-b3fc-2c963f66afa6
An arbitrary JSON object available to store stateful application information in. Must be valid JSON and have a maximum size of 2,000 characters.
{"key":"value","key2":"value2"}
Responses
- 201
- 401
- 404
- 422
The request has succeeded and a new resource has been created as a result.
- application/json
- Schema
- Example (from schema)
Schema
The generated Chat Token.
eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ
{
"token": "eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ"
}
Access is unauthorized.
- application/json
- Schema
Schema
string
Possible values: [Unauthorized
]
The server cannot find the requested resource.
- application/json
- Schema
Schema
string
Possible values: [Not Found
]
Client error
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Error type.
Error code.
Error details.
Request parameter associated with this error.
Link to developer resource for this error.
{
"errors": [
{
"type": "validation_error",
"code": "missing_required_parameter",
"message": "A required parameter is missing from the request. Please refer to the technical reference for a complete list of parameters.",
"attribute": "ttl",
"url": "https://developer.signalwire.com/rest/signalwire-rest/overview/error-codes/#missing_required_parameter"
}
]
}