Project Tokens

Regenerate API token

Changed on

Replaces a project API token's value and returns the new value. Use it to rotate a credential on a schedule, after it has been exposed, or when its value has been lost. The token keeps its id, name, and permissions, so there is nothing to re-enter; to change those, use Update API token.

The previous value stops working immediately, on every API that accepts a project API token. Anything still using it receives 401 Unauthorized until you give it the new value.

The response is the only place the new value is returned; store it securely. If you lose it, regenerate the token again.

The new value always uses the current token format: 42 characters beginning with swapi_. A token issued in the legacy format, 50 characters beginning with PT, changes format and length when regenerated, so update anything that validates or stores token values by length or prefix.

You can regenerate the token you are authenticating with. The request succeeds, but the value you sent is no longer valid once it does, so save the new value from the response before making any further request.

A token the caller cannot reach returns 404 Not Found. Use List API tokens to find the id of each token you can manage.

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.

post/api/project/tokens/{token_id}/regenerate

Request

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

Path parameters

token_idstring uuid required

Universal Unique Identifier.

The unique identifier of the token to regenerate.

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

Some revisions have not been checked yet.