# List Phone Numbers

`POST /phone-numbers/list`

List all owned phone numbers with pagination. Results are sorted by creation date, newest first.

## Authentication

Send your API key in the `PINNACLE-API-KEY` header.

## Request body

Required.

Content type: `application/json`.

### Fields

- `pageIndex` — `integer`, optional, default: 0; minimum: 0
- `pageSize` — `integer`, optional, default: 20; minimum: 1; maximum: 100

### Example

```json
{
  "pageIndex": 0,
  "pageSize": 20
}
```

## Responses

### 200

Returns paginated list of owned phone numbers.

Content type: `application/json`. Schema: `ListPhoneNumbersResponse`.

- `data` — `object[]`
- `data[].number` — `string`. Phone number in E.164 format.
- `data[].sms` — `boolean`. Whether SMS messaging is enabled.
- `data[].mms` — `boolean`. Whether MMS messaging is enabled.
- `data[].voice` — `boolean`. Whether voice calling is enabled.
- `data[].isSandbox` — `boolean`. Whether this is a sandbox phone number.
- `data[].createdAt` — `string`. ISO 8601 timestamp of when the phone number was added.
- `hasMore` — `boolean`
- `count` — `integer`

Example:

```json
{
  "data": [
    {
      "number": "+12125551234",
      "sms": true,
      "mms": true,
      "voice": true,
      "isSandbox": false,
      "createdAt": "2025-01-15T10:30:00Z"
    },
    {
      "number": "+18005551234",
      "sms": true,
      "mms": false,
      "voice": true,
      "isSandbox": false,
      "createdAt": "2025-01-10T08:00:00Z"
    }
  ],
  "hasMore": false,
  "count": 2
}
```

### 400

Validation failed. The payload has missing required fields and/or invalid types.

See https://zod.dev/error-formatting for more information.

Content type: `application/json`. Schema: `object`.

- `description` — `string`. Human-readable summary of validation failures.
- `errors` — `object`. 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

Example:

```json
{
  "description": "✖ Invalid input: expected string, received number\n  → at example_field",
  "errors": {
    "errors": [
      "Unrecognized key: 'extraKey'"
    ],
    "properties": {
      "example_field": {
        "errors": [
          "Invalid input: expected string, received NaN"
        ]
      }
    }
  }
}
```

### 401

The request lacks valid authentication credentials or the provided credentials are invalid.

Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

Content type: `application/json`. Schema: `object`.

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

Example:

```json
{
  "error": "Invalid API key."
}
```

### 500

An unexpected error occurred on Pinnacle's servers while processing your request.

If this error persists, please contact support with the request details.

Content type: `application/json`. Schema: `object`.

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

Example:

```json
{
  "error": "An unexpected error occurred while processing your request."
}
```

## SDK examples

### TypeScript

```typescript
import { PinnacleClient } from "rcs-js";

const client = new PinnacleClient({
  apiKey: process.env.PINNACLE_API_KEY!,
});

await client.phoneNumbers.list();
```

### Python

```python
import os
from rcs import Pinnacle

client = Pinnacle(
    api_key=os.environ["PINNACLE_API_KEY"],
)

client.phone_numbers.list()
```

### Ruby

```ruby
require "rcs"

client = Pinnacle::Client.new(
  api_key: ENV.fetch("PINNACLE_API_KEY")
)

client.phone_numbers.list
```

## Machine-readable schema

[OpenAPI 3.1 JSON](https://docs.pinnacle.sh/openapi.json)
