For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
  • Core
    • Overview
    • Authorization
    • Base URL
    • Data formats
    • Paging
    • Error codes
    • Permissions
  • Calling
  • Datasphere
  • Logs
  • Messaging
  • Phone Number Management
  • Platform
      • POSTCreate PubSub token
  • Resource Management
LogoLogoSignalWire Docs
Log inSign up
Support
PlatformPubSub Tokens

Create PubSub token

|View as Markdown|Open in Claude|
POST
https://{your_space_name}.signalwire.com/api/pubsub/tokens
POST
/api/pubsub/tokens
$curl -X POST https://{your_space_name}.signalwire.com/api/pubsub/tokens \
> -H "Content-Type: application/json" \
> -u "<project_id>:<api_token>" \
> -d '{
> "ttl": 15,
> "channels": {
> "channela": {
> "read": true,
> "write": false
> },
> "channelb": {
> "read": true
> }
> }
>}'
1{
2 "token": "eyJ0eXAiOiJWUlQiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2MjIxMjAxMjMsI...wMCwicnNlIjo5MDB9-BqG-DqC5LhpsdMWEFjhVkTBpQ"
3}
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](/docs/platform/your-signalwire-api-space).
Was this page helpful?
Previous

Get SIP profile

Next
Built with

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.

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, for which the access token will be valid. Between 1 and 43,200 (30 days).

channelsobjectRequired

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.

member_idstringOptional<=250 characters
The unique identifier of the member. Up to 250 characters. If not specified, a random UUID will be generated.
stateobjectOptionalDefaults to {}
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
A PubSub Token to be used to authenticate clients to the PubSub Service.

Errors

400
Bad Request Error
401
Unauthorized Error
422
Unprocessable Entity Error
500
Internal Server Error