REST ClientProject

create

View as MarkdownOpen in Claude

tokens.create

Create a new API token for the project.

Request

namestringRequired
The name representing the API token.
permissionslist of enumsRequired
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
subproject_idstringOptionalformat: "uuid"
The unique identifier of the subproject you would like to create a token for. The subproject passed must be a child of the project used to authenticate the request.

Response

idstringRequiredformat: "uuid"
The ID of the created API Token.
namestringRequired
The name of the created API Token.
permissionslist of enumsRequired
The permissions enabled for this token.
tokenstringRequired
The API token that can be used along with the project ID for basic authentication

Response Example

Response
1{
2 "id": "ea14556a-984f-11ee-b9d1-0242ac120002",
3 "name": "John Doe's Token",
4 "permissions": [
5 "calling",
6 "fax",
7 "messaging"
8 ],
9 "token": "PT037258e533e87ac63174ee136ed0798dc85d4f4f9e6d7191"
10}

Example

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9token = client.project.tokens.create(name="ci-token")
10print("Token:", token.get("token"))
11print("ID:", token.get("id"))