Project Tokens

Create API token

Changed on

Creates a project API token for server-side authentication to SignalWire REST APIs, with only the permission categories supplied in the request. Use it when a backend service needs durable project credentials; client applications should receive a service-specific token such as a Chat Token, PubSub Token, Room Token, or Subscriber Token instead. The token remains usable until you delete it or remove required permissions.

The Compatibility API exposes the same project tokens through its account-scoped route. Use Generate a new API Token for that request format.

The response is the only place the token secret is returned. Store it securely; no later request, including Update API token and List API tokens, can read it back. If you lose it, Regenerate API token issues a new value for the same token.

With a project API token, the new token belongs to the authenticated project, or to one of its subprojects when subproject_id is given; project_id is ignored. With a Personal access token, project_id is required and names the project the token is created for, which is how a root project created with Create a project gets its first credential.

Permissions

With a project API token, the token must have the following scope(s) enabled to make a successful request: Management.

With a Personal access token there are no scopes. The token holder must be an owner or admin of the space, and the request reaches only the projects the holder is enabled for, plus their subprojects.

Learn more about API scopes.

Token Permissions

You must set the functions allowed by this API Token by selecting which types of requests this API Token is allowed to make.

Valid options are: calling, chat, datasphere, fax, management, messaging, numbers, pubsub, storage, tasking, and video

post/api/project/tokens

Request

  • Base URL
    https://{Your_Space_Name}.signalwire.com
  • URL
    https://{Your_Space_Name}.signalwire.com/api/project/tokens
  • Auth
    • HTTP basic
    • or HTTP basic

Request body

namestring required

The name representing the API token.

permissionsProjectTokenPermission[] required

The permissions you would like to enable for this token. Valid permissions are calling, chat, datasphere, fax, management, messaging, numbers, pubsub, storage, tasking, and video

project_idstring uuid

Universal Unique Identifier.

subproject_idstring uuid

Universal Unique Identifier.

Example request

{
  "name": "John Doe's Token",
  "permissions": [
    "calling",
    "fax",
    "messaging"
  ]
}

Response

The request has succeeded.

idstring uuid required

Universal Unique Identifier.

namestring nullable required

The name of the API Token. null when the token has no name.

permissionsProjectTokenPermission[] required

The permissions enabled for this token.

last_used_atstring date-time nullable required

The date and time the token last authenticated a request. null if it never has.

revoked_atstring date-time nullable required

The date and time SignalWire revoked the token's value, for example after detecting that the value was exposed. null if it has not been revoked. A revoked token keeps its id and still appears in List API tokens, but its previous value no longer authenticates and no replacement value has been issued to you. To get a working value, regenerate the token, which also clears revoked_at.

tokenstring required

The API token that can be used along with the project ID for basic authentication. It is returned only when the token is created or regenerated and cannot be retrieved again; store it securely.

Example response

{
  "name": "John Doe's Token",
  "permissions": [
    "calling",
    "fax",
    "messaging"
  ],
  "last_used_at": "2024-05-06T12:20:00Z",
  "token": "swapi_0123456789ab0123456789ab0123456789ab"
}

Changes

    • breaking

      response property name list-of-types was widened by adding types null to media type application/json of response 200

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      the endpoint scheme security SignalWireBasicAuth was added to the API

    • info

      the endpoint scheme security SignalWirePersonalAccessTokenAuth was added to the API

    • info

      added the new optional request property

Some revisions have not been checked yet.