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

# Search for Available Phone Numbers

POST https://api.pinnacle.sh/phone-numbers/search
Content-Type: application/json

Search for available phone numbers that match your exact criteria.

Reference: https://docs.pinnacle.sh/api-reference/phone-numbers/search

## Authentication

- `PINNACLE-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a searchSchema.

- `type` (list of enum, required) — Types of phone numbers to return in your search.
  - Allowed values: `LOCAL`, `TOLL_FREE`
- `features` (list of enum, optional)
  - Allowed values: `SMS`, `MMS`, `VOICE`, `FAX`, `EMERGENCY`, `HD_VOICE`, `INTERNATIONAL_SMS`, `LOCAL_CALLING`
- `location` (SearchPhoneNumberByLocation, optional) — Filter your search by geographic location to find numbers in specific regions.&#x20; Toll-free numbers ignore city and state filters.
- `number` (SearchPhoneNumberByDigits, optional) — Filter your search by digit pattern.
- `options` (SearchPhoneNumberOptions, optional) — Extra search settings to control how many results you get.

## Response

### 200

Returns a **list** of available phone numbers that match the search criteria.&#x20; Use our [buy endpoint](./buy) to purchase any amount of phone numbers that you like.

- `list of PhoneNumber`

## Errors

### 400 Bad Request Error

Validation failed. The payload has missing required fields and/or invalid types.&#x20; See [https://zod.dev/error-formatting](https://zod.dev/error-formatting) for more information.

- `description` (string, required) — Human-readable summary of validation failures.
- `errors` (ZodErrorErrors, required) — Structured dictionary of issues containing two main sections: - `errors`: Array of global validation errors not tied to specific fields - `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

### 401 Unauthorized Error

The request lacks valid authentication credentials or the provided credentials are invalid.&#x20; Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 403 Forbidden Error

Your subscription does not include access to this feature.&#x20; This occurs when attempting to use functionality that requires a higher subscription tier. Please upgrade your subscription to access this feature.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 500 Internal Server Error

An unexpected error occurred on Pinnacle's servers while processing your request.&#x20; If this error persists, please contact support with the request details.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

## Types

### SearchPhoneNumberByLocation

Filter your search by geographic location to find numbers in specific regions.&#x20; Toll-free numbers ignore city and state filters.

- `city` (string, optional) — Search for numbers in your target city.
- `countryCode` ("US", optional) — Currently, only US numbers are supported.
- `nationalDestinationCode` (string, optional) — Narrow your search to a specific area or exchange code.&#x20; For US numbers, this is usually the 3-digit area code.
- `state` (string, optional) — Search for numbers in your target state or province using a two-letter code.

### SearchPhoneNumberByDigits

Filter your search by digit pattern.

- `contains` (string, optional) — Your search will return only numbers that contain this digit sequence anywhere within them.
- `endsWith` (string, optional) — Your search will return only numbers that end with these digits.
- `startsWith` (string, optional) — Your search will return only numbers that begin with these digits.

### SearchPhoneNumberOptions

Extra search settings to control how many results you get.

- `limit` (integer, optional, default: 10) — Set the maximum number of phone numbers to return.

### PhoneNumber

Details of a phone number available for purchase. Includes all essential data required for acquisition and operational planning.

- `number` (string, required) — Phone number in E.164 format.
- `phone_type` (enum, required) — Classification that defines the number's billing model and geographic scope.
  - Allowed values: `LOCAL`, `TOLL_FREE`
- `cost` (PhoneNumberCost, required) — Pricing details for the phone number.
- `features` (list of enum, required) — Supported communication capabilities associated with the number.
  - Allowed values: `SMS`, `MMS`, `VOICE`, `FAX`, `EMERGENCY`, `HD_VOICE`, `INTERNATIONAL_SMS`, `LOCAL_CALLING`
- `region` (PhoneNumberRegion, required) — Geographic and routing information for the phone number.

### ZodErrorErrors

Structured dictionary of issues containing two main sections: - `errors`: Array of global validation errors not tied to specific fields - `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

### PhoneNumberCost

Pricing details for the phone number.

- `monthly` (double, required) — Recurring monthly fee covering number ownership and basic services.
- `upfront` (double, required) — One-time activation or setup fee charged at purchase.
- `currency` (string, required) — Three-letter currency code for all pricing values.

### PhoneNumberRegion

Geographic and routing information for the phone number.

- `country` (string, required) — Two-letter country code where the number is registered.
- `state` (string, optional) — State or province code applicable to local numbers.
- `city` (string, optional) — Primary city or metropolitan area served by the number.
- `rateCenter` (string, optional) — Telecommunications rate center used for call routing and billing, defining local calling area boundaries.

## Examples

**Request**

```json
{
  "type": [
    "LOCAL"
  ],
  "features": [
    "SMS",
    "MMS"
  ],
  "location": {
    "city": "New York",
    "nationalDestinationCode": "212"
  },
  "number": {
    "contains": "514",
    "startsWith": "45"
  },
  "options": {
    "limit": 4
  }
}
```

**Response**

```json
[
  {
    "number": "+13324557514",
    "phone_type": "LOCAL",
    "cost": {
      "monthly": 1.15,
      "upfront": 1.15,
      "currency": "USD"
    },
    "features": [
      "HD_VOICE",
      "VOICE",
      "EMERGENCY",
      "FAX",
      "MMS",
      "SMS"
    ],
    "region": {
      "country": "US",
      "state": "NY",
      "city": "NEW YORK CITY",
      "rateCenter": "NEW YORK CITY ZONE 01"
    }
  }
]
```

**SDK Code**

```python Available Numbers
import requests

url = "https://api.pinnacle.sh/phone-numbers/search"

payload = {
    "type": ["LOCAL"],
    "features": ["SMS", "MMS"],
    "location": {
        "city": "New York",
        "nationalDestinationCode": "212"
    },
    "number": {
        "contains": "514",
        "startsWith": "45"
    },
    "options": { "limit": 4 }
}
headers = {
    "PINNACLE-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Available Numbers
const url = 'https://api.pinnacle.sh/phone-numbers/search';
const options = {
  method: 'POST',
  headers: {'PINNACLE-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"type":["LOCAL"],"features":["SMS","MMS"],"location":{"city":"New York","nationalDestinationCode":"212"},"number":{"contains":"514","startsWith":"45"},"options":{"limit":4}}'
};

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

```go Available Numbers
package main

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

func main() {

	url := "https://api.pinnacle.sh/phone-numbers/search"

	payload := strings.NewReader("{\n  \"type\": [\n    \"LOCAL\"\n  ],\n  \"features\": [\n    \"SMS\",\n    \"MMS\"\n  ],\n  \"location\": {\n    \"city\": \"New York\",\n    \"nationalDestinationCode\": \"212\"\n  },\n  \"number\": {\n    \"contains\": \"514\",\n    \"startsWith\": \"45\"\n  },\n  \"options\": {\n    \"limit\": 4\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("PINNACLE-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://api.pinnacle.sh/phone-numbers/search")

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

request = Net::HTTP::Post.new(url)
request["PINNACLE-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": [\n    \"LOCAL\"\n  ],\n  \"features\": [\n    \"SMS\",\n    \"MMS\"\n  ],\n  \"location\": {\n    \"city\": \"New York\",\n    \"nationalDestinationCode\": \"212\"\n  },\n  \"number\": {\n    \"contains\": \"514\",\n    \"startsWith\": \"45\"\n  },\n  \"options\": {\n    \"limit\": 4\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.pinnacle.sh/phone-numbers/search")
  .header("PINNACLE-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": [\n    \"LOCAL\"\n  ],\n  \"features\": [\n    \"SMS\",\n    \"MMS\"\n  ],\n  \"location\": {\n    \"city\": \"New York\",\n    \"nationalDestinationCode\": \"212\"\n  },\n  \"number\": {\n    \"contains\": \"514\",\n    \"startsWith\": \"45\"\n  },\n  \"options\": {\n    \"limit\": 4\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.pinnacle.sh/phone-numbers/search', [
  'body' => '{
  "type": [
    "LOCAL"
  ],
  "features": [
    "SMS",
    "MMS"
  ],
  "location": {
    "city": "New York",
    "nationalDestinationCode": "212"
  },
  "number": {
    "contains": "514",
    "startsWith": "45"
  },
  "options": {
    "limit": 4
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'PINNACLE-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp Available Numbers
using RestSharp;

var client = new RestClient("https://api.pinnacle.sh/phone-numbers/search");
var request = new RestRequest(Method.POST);
request.AddHeader("PINNACLE-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": [\n    \"LOCAL\"\n  ],\n  \"features\": [\n    \"SMS\",\n    \"MMS\"\n  ],\n  \"location\": {\n    \"city\": \"New York\",\n    \"nationalDestinationCode\": \"212\"\n  },\n  \"number\": {\n    \"contains\": \"514\",\n    \"startsWith\": \"45\"\n  },\n  \"options\": {\n    \"limit\": 4\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Available Numbers
import Foundation

let headers = [
  "PINNACLE-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": ["LOCAL"],
  "features": ["SMS", "MMS"],
  "location": [
    "city": "New York",
    "nationalDestinationCode": "212"
  ],
  "number": [
    "contains": "514",
    "startsWith": "45"
  ],
  "options": ["limit": 4]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.pinnacle.sh/phone-numbers/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```