Skip to Content
Phone numbers

Update a phone number

Permissionphone-numbers:updateAuthentication
PATCH
/phone-numbers/{id}

Updates supplied fields only. Explicit null clears label, agent assignment, or a fixed capacity limit. Agent changes on LiveKit SIP numbers reconcile asynchronously and may temporarily return status=provisioning.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

If-Match?string

Optional strong ETag (or *) from a prior response. A stale tag returns 412 without changing the resource.

Request Body

application/json
  1. body

Omitted fields are unchanged. Explicit null clears label, agent, flow or group assignment, or max_concurrent_outbound. Setting capacity mode to inherit or unlimited also clears the fixed limit. A number answers with one target, so assigning any of agent_id, flow_id or group_id implicitly clears the other two; naming more than one in the same request is rejected with 422.

Properties1 <= properties
inbound_routing_rules?array<|>

Ordered SIP-header routes. First matching route wins; agent_id on the phone number is the required default. A route may use one legacy condition or a conditions group matched with all (AND) or any (OR). At most 8 conditions are allowed per route and 64 across the number. Requires livekit_sip transport and inbound or both direction. Omit on PATCH to preserve; [] removes all routes; null is invalid. Changes provision header mappings automatically and return provisioning until reconciled. Values ignore case unless case_sensitive is true. Missing headers match only not_exists, never negative comparisons. An archived matching agent falls back to the default agent. Only new calls use changes; existing calls continue with their selected agent.

Itemsitems <= 32
label?|
Lengthlength <= 160
agent_id?|
Formatuuid
flow_id?|

Re-point the number at a flow. Setting it clears agent_id; null clears the flow assignment. Setting a flow requires the flows entitlement and a dispatchable flow; clearing it never does, so a workspace that lost the entitlement can always un-stick a number.

Formatuuid
group_id?|

Re-point the number at a group of agents. Setting it clears agent_id and flow_id; it cannot be combined with inbound_routing_rules and is refused on twilio_media_streams numbers. Setting a group requires the groups entitlement and a group with a member that can take calls now (422 on group_id: not_found, archived, no_members, conflict, unsupported_transport); null clears it and is never gated.

Formatuuid
direction?PhoneNumberDirection
Value in"inbound""outbound""both"
outbound_capacity_mode?PhoneNumberOutboundCapacityMode
Value in"inherit""fixed""unlimited"
max_concurrent_outbound?|
Range1 <= value
outbound_weight?integer
Range1 <= value <= 10000
outbound_draining?boolean

Response Body

Updated phone number.

application/json
  1. response

Complete safe phone-number configuration and provider state. Raw provider errors are never present in the public representation.

inbound_routing_rules?array<|>

Ordered SIP-header routes. First matching route wins; agent_id on the phone number is the required default. A route may use one legacy condition or a conditions group matched with all (AND) or any (OR). At most 8 conditions are allowed per route and 64 across the number. Requires livekit_sip transport and inbound or both direction. Omit on PATCH to preserve; [] removes all routes; null is invalid. Changes provision header mappings automatically and return provisioning until reconciled. Values ignore case unless case_sensitive is true. Missing headers match only not_exists, never negative comparisons. An archived matching agent falls back to the default agent. Only new calls use changes; existing calls continue with their selected agent.

Itemsitems <= 32
id*string
Formatuuid
trunk_id*string
Formatuuid
trunk_name*string
e164*E164PhoneNumber

An E.164 number with a non-zero country code and 7 to 15 digits, or a bare internal number/extension of 1 to 20 [0-9*#] characters (e.g. 103, 2770124).

Match^(\+[1-9][0-9]{7,14}|[0-9*#]{1,20})$
label*string|null
agent_id*|
Formatuuid
agent_slug*string|null
flow_id*|

The flow this number answers with, or null when it answers with a single agent. Exactly one of the agent_id/agent_slug pair and the flow_id/flow_slug pair is ever non-null. The agent that actually answers a flow-targeted number is the flow's start agent; it is deliberately not mirrored into agent_slug, so this read model keeps reporting what the operator configured.

Formatuuid
flow_slug*string|null
group_id*|

The group this number answers with, or null. When set, agent_id and agent_slug read null: the agent that answers is picked per call from the group's members, and the session records it (group_member_id on the call). At most one of agent_id, flow_id and group_id is non-null.

Formatuuid
group_name*string|null
direction*PhoneNumberDirection
Value in"inbound""outbound""both"
transport*PhoneNumberTransport
Value in"livekit_sip""twilio_media_streams"
livekit_inbound_trunk_id*string|null
livekit_dispatch_rule_id*string|null
status*PhoneNumberStatus
Value in"provisioning""active""error""archived"
last_error*|

Sanitized recovery-oriented message.

last_error_code*|

Stable machine-readable provider/provisioning error code.

archived_at*|
Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
outbound_capacity_mode*PhoneNumberOutboundCapacityMode
Value in"inherit""fixed""unlimited"
max_concurrent_outbound*integer|null
outbound_weight*integer
Range1 <= value
outbound_draining*boolean
Example Request
curl -X PATCH 'https://api.kejue.co/v1/phone-numbers/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "inbound_routing_rules": [    {      "header": "string",      "operator": "equals",      "value": "string",      "case_sensitive": false,      "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978"    }  ],  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "trunk_id": "d1c0247b-6570-4df5-9107-7986a22149d1",  "trunk_name": "string",  "e164": "string",  "label": "string",  "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",  "agent_slug": "string",  "flow_id": "0746f03b-16cc-49fb-9833-df3713d407d2",  "flow_slug": "string",  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",  "group_name": "string",  "direction": "inbound",  "transport": "livekit_sip",  "livekit_inbound_trunk_id": "string",  "livekit_dispatch_rule_id": "string",  "status": "provisioning",  "last_error": "string",  "last_error_code": "string",  "archived_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "outbound_capacity_mode": "inherit",  "max_concurrent_outbound": 0,  "outbound_weight": 1,  "outbound_draining": true}