Skip to main content
POST
/
api
/
agents
/
{agent_id}
/
assign-phone-number
{
  "phone_number_id": "phon_b2c3d4e5f6a7"
}
{
  "success": true,
  "message": "Phone number assigned successfully",
  "data": {
    "agent_id": "agent_a1b2c3d4e5f6",
    "agent_name": "Sales Rep",
    "assigned_phone_number_ids": ["phon_b2c3d4e5f6a7"],
    "updated_at": "2024-01-20T14:45:00Z"
  }
}
Assign a phone number to an agent. This enables the agent to handle inbound calls to this number.
For Twilio phone numbers, this endpoint automatically configures the webhook URLs in Twilio.

Headers

X-API-Key
string
required
Your API key for authentication.
X-Organization-Id
string
required
The organization ID.
Content-Type
string
required
Must be application/json.

Path Parameters

agent_id
string
required
The unique identifier of the agent.

Request Body

phone_number_id
string
required
The unique identifier of the phone number to assign (format: phon_[a-f0-9]{12,}).

Permissions

  • phone_numbers:update (admin, agent_manager)

Response

success
boolean
Indicates if the assignment was successful.
message
string
Human-readable success message.
data
object
The updated agent object.
{
  "phone_number_id": "phon_b2c3d4e5f6a7"
}
{
  "success": true,
  "message": "Phone number assigned successfully",
  "data": {
    "agent_id": "agent_a1b2c3d4e5f6",
    "agent_name": "Sales Rep",
    "assigned_phone_number_ids": ["phon_b2c3d4e5f6a7"],
    "updated_at": "2024-01-20T14:45:00Z"
  }
}

Errors

404
object
Agent or phone number not found.
403
object
Access denied to agent or phone number belongs to different organization.
409
object
Phone number already assigned to another agent, or already assigned to this agent.
400
object
Phone number has no associated integration (for Twilio numbers).