# Get Phone Numbers — Telnyx

> Get a list of phone numbers. See the documentation

- Key: `telnyx-get-phone-numbers`
- Type: Action (Read-only)
- Version: 0.0.5
- App: Telnyx (`telnyx`) — https://pipedream.com/apps/telnyx.md
- This page (HTML): https://pipedream.com/apps/telnyx/actions/get-phone-numbers
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/telnyx/actions/get-phone-numbers/get-phone-numbers.mjs

## Description

Get a list of phone numbers. [See the documentation](https://developers.telnyx.com/api/numbers/list-phone-numbers)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `pageSize` | `integer` | No | The size of the page. |
| `pageNumber` | `integer` | No | The page number to load. |
| `tag` | `string` | No | Filter by tag. |
| `phoneNumber` | `string` | No | Filter by phone number. Requires at least three digits. Non-numerical characters will result in no values being returned. |
| `status` | `string` | No | Filter by phone number status. |
| `connectionId` | `string` | No | Filter by connection Id. |
| `contains` | `string` | No | Filter contains connection name. Requires at least three characters. |
| `startsWith` | `string` | No | Filter starts with connection name. Requires at least three characters. |
| `endsWith` | `string` | No | Filter ends with connection name. Requires at least three characters. |
| `equals` | `string` | No | Filter by connection name. |
| `paymentMethod` | `string` | No | Filter by usage payment method. |
| `billingGroupId` | `string` | No | Filter by the billing group Id associated with phone numbers. To filter to only phone numbers that have no billing group associated them, set the value of this filter to the string 'null'. |
| `emergencyAddressId` | `string` | No | Filter by the emergency_address_id associated with phone numbers. To filter only phone numbers that have no emergency address associated with them, set the value of this filter to the string 'null'. |
| `customerReference` | `string` | No | Filter numbers via the customer reference set. |
| `sort` | `string` | No | Specifies the sort order for results. If not given, results are sorted by created_at in descending order. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "telnyx",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "telnyx-get-phone-numbers",
  arguments: {
    pageSize: 10,
    pageNumber: 10,
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "telnyx-get-phone-numbers",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    telnyx: { authProvisionId: "apn_xxxxxxx" },
    pageSize: 10,
    pageNumber: 10,
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "telnyx-get-phone-numbers",
    "configured_props": {
      "telnyx": { "authProvisionId": "apn_xxxxxxx" },
      "pageSize": 10,
      "pageNumber": 10
    }
  }'
```

---

- App: https://pipedream.com/apps/telnyx.md · All apps: https://pipedream.com/apps
