---
title: "Route a number to an agent"
method: POST
path: "/v1/telephony/numbers/{id}/assign"
tags: ["Telephony"]
---

# Route a number to an agent

`POST /v1/telephony/numbers/{id}/assign`

## Request

- Base URL: `https://api.pyai.com`
- URL: `https://api.pyai.com/v1/telephony/numbers/{id}/assign`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Bind the number to an `agent_id` (or pass `null` to unassign) so inbound calls open that agent's Omni session. Requires the `telephony:manage` scope.

## Path parameters

- `id` string, required

## Request body

- TelephonyAssignRequest
  - `agent_id` string, nullable: Agent to bind, or null to unassign.

## Response `200`

Updated

- TelephonyNumber
  - `object` string
  - `id` string
  - `phone_number` string: E.164.
  - `country` string
  - `area_code` string, nullable
  - `capabilities` object
    - `voice` boolean
    - `sms` boolean
  - `agent_id` string, nullable: Agent that answers inbound calls to this number.
  - `recording` boolean: Whether PyAI recording is enabled for the number.
  - `monthly_cost_cents` integer
  - `status` 'active' | 'released'
  - `created_at` integer: Unix ms.
  - `released_at` integer, nullable: Unix ms.

## Other responses

- `401`: Missing or invalid API key (`code: unauthorized`)
- `404`: Resource not found (`code: not_found`)

---

[API](https://skmtc.dev/pyai/apis/pyai-api.md) · [All operations](https://skmtc.dev/pyai/apis/pyai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pyai/apis/pyai-api/revisions/271a1539185b?raw)
