list_numbers

View as MarkdownOpen in Claude

List phone numbers assigned to a campaign.

Path parameters

idstringRequiredformat: "uuid"
Unique ID of the campaign.

Query parameters

filter_statestringOptional
The state of the assignments in the registration process, such as pending or complete. Will return all assignments with this value.

Response

datalist of objectsOptional
List of assigned numbers.

Response Example

Response
1{
2 "links": {
3 "self": "string",
4 "first": "string",
5 "next": "string",
6 "prev": "string"
7 },
8 "data": [
9 {
10 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
11 "state": "pending",
12 "campaign_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
13 "phone_number": {
14 "id": "string",
15 "name": "Jenny",
16 "number": "+15558675309",
17 "status_callback_url": "https://example.com/handle_callback"
18 },
19 "created_at": "2024-01-15T09:30:00Z",
20 "updated_at": "2024-01-15T09:30:00Z"
21 }
22 ]
23}

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
9numbers = client.registry.campaigns.list_numbers("campaign-id")
10for n in numbers.get("data", []):
11 print(n.get("number"), n.get("id"))