> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# List phone numbers

GET https://%7BYour_Space_Name%7D.signalwire.com/api/relay/rest/phone_numbers

Lists the phone numbers owned by your SignalWire project. These numbers can send or receive communications according to their capabilities and assigned handlers. Use [Search phone numbers](/docs/apis/rest/phone-numbers/search-available-phone-numbers) for numbers available to purchase, or Compatibility [Incoming Phone Numbers](/docs/compatibility-api/rest/incoming-phone-numbers/list-incoming-phone-numbers) for SID-based routes. Results are sorted by creation date, most recent first.

#### Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Numbers_.

[Learn more about API scopes](/docs/platform/your-signalwire-api-space).

Reference: https://signalwire.com/docs/apis/rest/phone-numbers/list-phone-numbers

## Authentication

- `Authorization` header (basic auth, required) — SignalWire Basic Authentication using Project ID and API Token. The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password. Example: ``` Authorization: Basic base64(project_id:token) ```

## Request

### Query parameters

- `filter_name` (string, optional) — The name given to the phone number. Will return all Phone Numbers containing this value as a substring.
- `filter_number` (string, optional) — The phone number in E164 format. Will return all Phone Numbers containing this value as a substring.
- `page_number` (integer, optional, default: 0) — The page number to retrieve (0-indexed).
- `page_size` (integer, optional, default: 50) — The number of items per page (1-1000).
- `page_token` (string, optional) — Token for cursor-based pagination. Required when page_number > 0.

## Response

### 200

The request has succeeded.

- `links` (PaginationLinks, required) — Pagination links.
- `data` (list of PhoneNumber, required) — List of phone numbers.

## Errors

### 400 Bad Request Error

The request is invalid.

- `error` (enum, required)
  - Allowed values: `Bad Request`

### 401 Unauthorized Error

Access is unauthorized.

- `error` (enum, required)
  - Allowed values: `Unauthorized`

### 500 Internal Server Error

An internal server error occurred.

- `error` (enum, required)
  - Allowed values: `Internal Server Error`

## Types

### PaginationLinks

Pagination links for list responses.

- `self` (string, required) — Link to the current page.
- `first` (string, required) — Link to the first page.
- `next` (string, optional) — Link to the next page. Only present when there are more results.
- `prev` (string, optional) — Link to the previous page. Only present when not on the first page.

### PhoneNumber

Phone number model.

- `id` (string, required) — The unique identifier of the phone number.
- `number` (string, required) — The phone number in E.164 format.
- `name` (string, required, nullable) — The name given to the phone number. Helps to distinguish different phone numbers within your project.
- `capabilities` (list of enum, required) — A list of communication methods this phone number supports.
  - Allowed values: `voice`, `sms`, `mms`, `fax`
- `number_type` (enum, required) — The type of number this is defined as.
  - Allowed values: `toll-free`, `longcode`
- `e911_address_id` (string, required, nullable) — The E911 address ID associated with this phone number.
- `e911_status` (enum, required, nullable) — The E911 provisioning status for this phone number. `null` when the number has never had an E911 address assigned. Once an address is assigned the value is `pending` while the carrier processes the order, then `active` once the carrier confirms the registration, or `failed` if the carrier does not confirm it. Removing the address sets `pending_removal`, and the value becomes `unregistered` once the carrier confirms the removal.
  - Allowed values: `pending`, `active`, `failed`, `pending_removal`, `unregistered`
- `cnam` (string, required, nullable) — The caller ID name currently applied at the carrier for this phone number, or `null` when none is set. This is the name call recipients can see. Change it with [Request a caller ID name](/docs/apis/rest/caller-id-name/request-caller-id-name). This value changes only after a request is approved and applied at the carrier, so it can differ from the requested `name` while a request is being reviewed or after one is rejected or fails.
- `created_at` (datetime, required) — The date the number was added to your project.
- `updated_at` (datetime, required) — The date the number was last updated.
- `next_billed_at` (datetime, required, nullable) — The next date the number will be billed for.
- `call_handler` (enum, required, nullable) — What type of handler you want to run on inbound calls.
  - Allowed values: `relay_context`, `relay_topic`, `relay_script`, `relay_application`, `relay_connector`, `relay_sip_endpoint`, `relay_verto_endpoint`, `laml_webhooks`, `laml_application`, `dialogflow`, `video_room`, `call_flow`, `ai_agent`, `fabric_subscriber`, `sip_gateway`, `call_queue`
- `calling_handler_resource_id` (string, required, nullable) — The unique identifier of the calling handler resource.
- `call_receive_mode` (enum, required) — How do you want to receive the incoming call.
  - Allowed values: `voice`, `fax`
- `call_request_url` (string, required, nullable) — The URL to make a request to when using the laml_webhooks call handler.
- `call_request_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_request_url.
  - Allowed values: `GET`, `POST`
- `call_fallback_url` (string, required, nullable) — The fallback URL to make a request to when using the laml_webhooks call handler and the call_request_url fails.
- `call_fallback_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_fallback_url.
  - Allowed values: `GET`, `POST`
- `call_status_callback_url` (string, required, nullable) — The URL to make status callbacks to when using the laml_webhooks call handler.
- `call_status_callback_method` (enum, required, nullable) — The HTTP method to use when making a request to the call_status_callback_url.
  - Allowed values: `GET`, `POST`
- `call_laml_application_id` (string, required, nullable) — The ID of the LaML Application to use when using the laml_application call handler.
- `call_dialogflow_agent_id` (string, required, nullable) — The ID of the Dialogflow Agent to start when using the dialogflow call handler.
- `call_relay_topic` (string, required, nullable) — A string representing the Relay topic to forward incoming calls to. This is only used (and required) when call_handler is set to relay_topic.
- `call_relay_topic_status_callback_url` (string, required, nullable) — A string representing a URL to send status change messages to. This is only used (and required) when call_handler is set to relay_topic.
- `call_relay_script_url` (string, required, nullable) — The URL to make a request to when using the relay_script call handler. The URL must respond with a valid SWML script.
- `call_relay_context` (string, required, nullable) — The name of the Relay Context to send this call to when using the relay_context call handler.
- `call_relay_context_status_callback_url` (string, required, nullable) — A string representing a URL to send status change messages to. This is only used (and required) when call_handler is set to relay_context.
- `call_relay_application` (string, required, nullable) — The name of the Relay Application to send this call to when using the relay_application call handler.
- `call_relay_connector_id` (string, required, nullable) — The ID of the Relay Connector to send this call to when using the relay_connector call handler.
- `call_sip_endpoint_id` (string, required, nullable) — The ID of the Relay SIP Endpoint to send this call to when using the relay_sip_endpoint call handler.
- `call_verto_resource` (string, required, nullable) — The name of the Verto Relay Endpoint to send this call to when using the relay_verto_endpoint call handler.
- `call_video_room_id` (string, required, nullable) — The ID of the Video Room to send this call to when using the video_room call handler.
- `message_handler` (enum, required, nullable) — What type of handler you want to run on inbound messages.
  - Allowed values: `relay_context`, `relay_topic`, `relay_application`, `laml_webhooks`, `laml_application`
- `messaging_handler_resource_id` (string, required, nullable) — The unique identifier of the messaging handler resource.
- `message_request_url` (string, required, nullable) — The URL to make a request to when using the laml_webhooks message handler.
- `message_request_method` (enum, required, nullable) — The HTTP method to use when making a request to the message_request_url.
  - Allowed values: `GET`, `POST`
- `message_fallback_url` (string, required, nullable) — The fallback URL to make a request to when using the laml_webhooks message handler and the message_request_url fails.
- `message_fallback_method` (enum, required, nullable) — The HTTP method to use when making a request to the message_fallback_url.
  - Allowed values: `GET`, `POST`
- `message_laml_application_id` (string, required, nullable) — The ID of the LaML Application to use when using the laml_application message handler.
- `message_relay_topic` (string, required, nullable) — The name of the Relay Topic to send this message to when using the relay_topic message handler.
- `message_relay_context` (string, required, nullable) — The name of the Relay Context to send this message to when using the relay_context message handler.
- `country_code` (string, required, nullable) — The ISO 3166-1 alpha-2 country code of the phone number.

## Examples

**Response**

```json
{
  "links": {
    "self": "string",
    "first": "string",
    "next": "string",
    "prev": "string"
  },
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "number": "+15558675309",
      "name": "Jenny",
      "capabilities": [
        "voice"
      ],
      "number_type": "toll-free",
      "e911_address_id": "string",
      "e911_status": "active",
      "cnam": "ACME PLUMBING",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "next_billed_at": "2024-01-15T09:30:00Z",
      "call_handler": "relay_context",
      "calling_handler_resource_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
      "call_receive_mode": "voice",
      "call_request_url": "string",
      "call_request_method": "POST",
      "call_fallback_url": "string",
      "call_fallback_method": "POST",
      "call_status_callback_url": "string",
      "call_status_callback_method": "POST",
      "call_laml_application_id": "string",
      "call_dialogflow_agent_id": "string",
      "call_relay_topic": "office",
      "call_relay_topic_status_callback_url": "https://myapplication/handle_relay_callbacks",
      "call_relay_script_url": "https://example.signalwire.com/relay-bins/60e2ba7b-366e-44de-84e3-0c76cfccf1cc",
      "call_relay_context": "my_relay_app",
      "call_relay_context_status_callback_url": "https://myapplication/handle_relay_callbacks",
      "call_relay_application": "my_relay_app",
      "call_relay_connector_id": "string",
      "call_sip_endpoint_id": "string",
      "call_verto_resource": "string",
      "call_video_room_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
      "message_handler": "relay_application",
      "messaging_handler_resource_id": "fe4093d9-58c2-4931-b4b9-5679f82652c6",
      "message_request_url": "string",
      "message_request_method": "POST",
      "message_fallback_url": "string",
      "message_fallback_method": "POST",
      "message_laml_application_id": "string",
      "message_relay_topic": "string",
      "message_relay_context": "my_relay_app",
      "country_code": "US"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers"

response = requests.get(url, auth=("<project_id>", "<api_token>"))

print(response.json())
```

```javascript
const url = 'https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers';
const credentials = btoa("<project_id>:<api_token>");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<project_id>", "<api_token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request.basic_auth("<project_id>", "<api_token>")

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers")
  .basicAuth("<project_id>", "<api_token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers', [
  'headers' => [
  ],
    'auth' => ['<project_id>', '<api_token>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers");
client.Authenticator = new HttpBasicAuthenticator("<project_id>", "<api_token>");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<project_id>:<api_token>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/relay/rest/phone_numbers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```