> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.agentphone.to/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.agentphone.to/_mcp/server.

# List Available Numbers

GET https://api.agentphone.ai/v1/numbers/available

Search purchasable phone numbers before buying one.

Pick a number here, then buy it by passing the same `phoneNumber` to
`POST /v1/numbers`. Searching with no criteria returns a page of whatever
is currently in stock.

**Results are not reserved.** This is live inventory, so a number can be
bought by someone else between your search and your purchase. When that
happens the purchase returns `409` with fresh alternatives in this same
shape; pick another and retry rather than treating it as fatal.

Criteria support varies by account, and there is no single rule that
holds everywhere:

- `areaCode` is the most broadly supported filter.
- `city`, `state` and `zip` work on some accounts and not others.
  Where they aren't supported they are ignored rather than rejected, so
  check what comes back instead of assuming the filter applied.
- `state` on its own is honored on some accounts and rejected with `400`
  on others. Pair it with `city` for consistent behavior.

Returns `404` when number search isn't available on your account at all,
and `422` when it isn't configured yet. If you need location search and
aren't getting it, contact support.

Giving a Canadian area code searches Canada even though `country`
defaults to `US`.

`country=UK` (or `GB`) returns United Kingdom mobile numbers on accounts
where they're available. UK numbers are SMS-only and have no area codes,
so location filters are rejected for UK searches.

If `widened` is true, your exact criteria were out of stock and these are
nearby alternatives instead.

Reference: https://docs.agentphone.to/api-reference/numbers/list-available-numbers-v-1-numbers-available-get

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `areaCode` (string, optional, nullable) — 3-digit area code, e.g. "415". The most broadly supported filter.
- `city` (string, optional, nullable) — City name. Pair with state. Support varies by account.
- `state` (string, optional, nullable) — 2-letter state code, e.g. "CA". Pair with city for consistent results; standalone support varies by account.
- `zip` (string, optional, nullable) — 5-digit ZIP. Support varies by account.
- `country` (string, optional, default: US) — "US", "CA", or "UK" ("GB" is accepted as an alias). United Kingdom availability varies by account.
- `limit` (integer, optional, default: 10) — Max results, 1-30.

## Response

### 200

Successful Response

- `data` (list of AvailableNumber, required)
- `widened` (boolean, optional, default: false)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### AvailableNumber

One purchasable number from GET /v1/numbers/available. Geography is best-effort: `city`, `state` and `rateCenter` are null when the inventory source doesn't return per-number detail. Only `phoneNumber` is guaranteed, and it is the field to pass back to POST /v1/numbers.

- `phoneNumber` (string, required)
- `city` (string, optional, nullable)
- `state` (string, optional, nullable)
- `rateCenter` (string, optional, nullable)
- `areaCode` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

- string
- integer

## Examples

**Response**

```json
{
  "data": [
    {
      "phoneNumber": "string",
      "city": "string",
      "state": "string",
      "rateCenter": "string",
      "areaCode": "string"
    }
  ],
  "widened": false
}
```

**SDK Code**

```python
import requests

url = "https://api.agentphone.ai/v1/numbers/available"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.agentphone.ai/v1/numbers/available';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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://api.agentphone.ai/v1/numbers/available"

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

	req.Header.Add("Authorization", "Bearer <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://api.agentphone.ai/v1/numbers/available")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <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://api.agentphone.ai/v1/numbers/available")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentphone.ai/v1/numbers/available', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.agentphone.ai/v1/numbers/available");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentphone.ai/v1/numbers/available")! 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()
```