Chat Tokens
Create chat token
Creates a time-limited Chat Token that a client consumes to access the Chat channels and permissions supplied in the request. Call this operation from your server when granting Chat access to a member; choose a lifetime from 1 minute through 30 days and never expose the project API token used to create it. Use Create PubSub token for PubSub channels or Create API token for server-side REST authentication.
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
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.
Example response
{
"token": "eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ"
}Changes
No changes found, but 3 of the 137 revisions have a changelog that could not be searched — this endpoint may have changed in one of them.