Create chat token

View as MarkdownOpen in Claude
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](/docs/platform/your-signalwire-api-space).

Authentication

AuthorizationBasic
SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ```

Request

This endpoint expects an object.
ttlintegerRequired1-43200

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

channelsobjectRequired

User-defined channel names with read/write permissions. Max of 500 channels. Channel names cannot start with the reserved prefix sw_ and can be up to 250 characters.

member_idstringOptional<=250 characters
The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.
stateobjectOptional
An arbitrary JSON object available to store stateful application information in. Must be valid JSON and have a maximum size of 2,000 characters.

Response

The request has succeeded.
tokenstring
The generated Chat Token.

Errors

400
Bad Request Error
401
Unauthorized Error
422
Unprocessable Entity Error