Assign to an agent
assign a phone number to an agent.
POST
https://api.centerfy.ai/webhooks/inbound/phone-numbers/:id/agent Headers
| Header | Required | Value | Description |
|---|---|---|---|
x-api-key | Yes | your sub-account API key (cfy_…) | Your API key. Alternatively, pass it as Authorization: Bearer <key>. |
Content-Type | Yes | application/json | Request body is JSON. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | Yes | The phone number id to assign. |
Body parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
agent_id | string | Yes | — | The agent id to assign the number to. Required, and must be a valid UUID for an agent you own, else 400/404. |
Request body
{
"agent_id": "<agent_id>"
}Example
curl -X POST "https://api.centerfy.ai/webhooks/inbound/phone-numbers/{id}/agent" \
-H "x-api-key: $CENTERFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "<agent_id>"
}' import { CenterfyClient } from "@centerfy/sdk";
const centerfy = new CenterfyClient({ apiKey: process.env.CENTERFY_API_KEY! });
const result = await centerfy.phoneNumbers.assignAgent("<phoneNumberId>", {
"agent_id": "<agent_id>"
});
console.log(result); centerfy phoneNumbers assign-agent <phoneNumberId> '{"agent_id":"<agent_id>"}' MCP tool: centerfy_phone_numbers_assign_agent (see MCP server)
Response
{
"status": "success",
"assigned": true,
"phone_number_id": "3f1c2b9a-7d4e-4a21-9c33-0a1b2c3d4e5f",
"phone_number": "+14155552671",
"agent_id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab"
}Errors
400— for invalid UUIDs; 404 if the number or agent does not exist; 409 if the number is already assigned to a DIFFERENT agent (unassign first); 502 if provisioning fails.
Notes
Assigning a number routes its inbound calls to the agent. Idempotent when re-assigning to the SAME agent (returns 200 with already_assigned: true).