Agents
Attach Agent Phone Number
Attach a workspace phone number to a DialNexa agent for inbound or outbound calls.
POST
Attach Agent Phone Number
Changes state - verify before retry
Attach an agent phone number to route calls through that agent. Choose
inbound so the number rings the agent, or outbound so the agent can call from it. The link belongs to the agent, not to a version: every version uses it, inbound calls run on the latest published version, and calls and batches pick the version they dial with.
Before you begin
- Publish at least one version of the agent with Update Agent. An agent with no published version cannot take a number.
- Get the number’s
phn_ID from List Phone Numbers, Buy Phone Number, or Link SIP Trunk. - Check List Agent Phone Numbers. An agent can have at most three inbound and three outbound numbers.
Limits
Attach agent phone number request
Verify the result
A201 response returns the new link in data, with linked_at set and unlinked_at null. Call List Agent Phone Numbers to confirm the number appears under the chosen direction. Once an agent has two or more outbound numbers, Create Call and Create Batch Call need phone_number_id to choose one.
Errors and recovery
Refusals carry a code indata.code.
If a request times out, list the agent’s numbers before retrying. A repeat of a request that succeeded returns
409 PHONE_NUMBER_ALREADY_LINKED and changes nothing.
Move a number from another agent
Add"move": true to the attach request to move the number in the chosen direction. The old agent loses that direction and the new agent receives it in one transaction. The opposite direction stays unchanged. The old link is closed with unlink_reason: "manual".
Live calls on the number block either direction with 409 PHONE_NUMBER_HAS_LIVE_CALLS. For an outbound move, unfinished batches return NUMBER_USED_BY_BATCH and active workflows return PHONE_NUMBER_USED_IN_ACTIVE_WORKFLOWS. Change the affected batches’ number or cancel them, pause the affected workflows, and wait for calls to finish before retrying. If the request times out, check both agents’ number lists and link history before sending it again.
Related endpoints
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Agent ID from List Agents.
Example:
"agent_2g7Xy3tY53gRlp"
Body
application/json
Organization phone number to attach
Example:
"phn_2g7Xy3tY53gRlp"
Available options:
inbound, outbound Move the number here when another agent holds it in this direction. That agent loses it in the same request, under the same rules as detaching it there.