REST ClientShort Codes

list

View as MarkdownOpen in Claude

List short codes in the project.

Query parameters

filter_namestringOptional
Filter by name. Returns all short codes containing this value as a substring.
filter_numberstringOptional
Filter by number. Returns all short codes containing this value as a substring.
page_numberintegerOptionalDefaults to 0
The page number to retrieve.
page_sizeintegerOptional1-1000Defaults to 50
The number of results per page.
page_tokenstringOptional
Token for cursor-based pagination.

Response

datalist of objectsRequired
List of short codes.

Response Example

Response
{
"links": {
"self": "string",
"first": "string",
"next": "string",
"prev": "string"
},
"data": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "My Short Code",
"number": "12345",
"capabilities": [
"sms"
],
"number_type": "shortcode",
"code_type": "vanity",
"country_code": "US",
"created_at": "2023-01-15T10:30:00Z",
"updated_at": "2023-01-15T10:30:00Z",
"next_billed_at": "2024-01-15T10:30:00Z",
"lease_duration": "12 months",
"message_handler": "relay_context",
"message_request_url": "https://example.com/message",
"message_request_method": "GET",
"message_fallback_url": "https://example.com/fallback",
"message_fallback_method": "GET",
"message_laml_application_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"message_relay_context": "my-context"
}
]
}

Example

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
result = client.short_codes.list()
for code in result.get("data", []):
print(code.get("short_code"), code.get("id"))