Connect a phone number
Creates a durable phone-number row and schedules provider routing after commit. Poll resource_url until status is active or error. Use Idempotency-Key so a retry cannot connect the same intent twice.
bearerAuthAuthorizationBearer <token>Use a Voice API key or connected-app OAuth access token. Authentication.
Idempotency-Key*stringRequired. Reuse the same key to retry this write safely. Retries and idempotency.
^[A-Za-z0-9!#$%&'*+.^_`|~-]+$1 <= length <= 255application/json- body
Connects a purchased or BYO number to an active SIP trunk. livekit_sip is the default transport. twilio_media_streams is available only on an active twilio_automated trunk and configures Twilio Programmable Voice instead of LiveKit SIP.
direction defaults to inbound. outbound_capacity_mode defaults to inherit; fixed requires max_concurrent_outbound, while that limit is forbidden for inherit and unlimited. agent_id may be omitted to create an unassigned route. At most one of agent_id, flow_id and group_id may be set.
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.
items <= 32trunk_id*stringuuide164*E164PhoneNumberAn 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).
^(\+[1-9][0-9]{7,14}|[0-9*#]{1,20})$label?stringlength <= 160agent_id?stringuuidflow_id?stringAnswer inbound calls with a flow instead of a single agent. The flow's start agent takes the call and the graph's handoffs take over. Mutually exclusive with agent_id, and rejected with 422 unless the flow is dispatchable now (un-archived, at least one agent on the canvas, and a start agent with a published version). Requires the flows entitlement.
uuidgroup_id?stringAnswer inbound calls with a group of agents. The group's routing strategy picks a member for the caller's number. Mutually exclusive with agent_id, flow_id and inbound_routing_rules (422 conflict). Rejected on twilio_media_streams numbers (422 unsupported_transport) and unless the group exists (not_found), is not archived (archived) and has a member that can take calls now (no_members). Requires the groups entitlement (403 entitlement_required).
uuiddirection?PhoneNumberDirection"inbound""outbound""both"transport?PhoneNumberTransport"livekit_sip""twilio_media_streams"outbound_capacity_mode?PhoneNumberOutboundCapacityMode"inherit""fixed""unlimited"max_concurrent_outbound?integer1 <= valueoutbound_weight?integer1 <= value <= 100001outbound_draining?booleanfalseThe phone number was created and provider provisioning was scheduled.
application/json- response
id*stringuuidstatus*stringresource_url*string^/v1/phone-numbers/[0-9a-f-]+$poll_after_seconds*integer1 <= valueprovisioning_async*booleancurl -X POST 'https://api.kejue.co/v1/phone-numbers' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{ "trunk_id": "d1c0247b-6570-4df5-9107-7986a22149d1", "e164": "string"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "status": "provisioning", "resource_url": "string", "poll_after_seconds": 1, "provisioning_async": true}