Skip to main content
POST
/
api
/
v1
/
phone-numbers
/
{number}
/
connect-agent
/
cURL
curl --request POST \
  --url https://alpha-plagiocephalic-darrell.ngrok-free.dev/api/v1/phone-numbers/{number}/connect-agent/ \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "number": "<string>",
  "whatsappPhoneNumberId": "<string>"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "number": "<string>",
  "whatsappPhoneNumberId": "<string>",
  "whatsappBusinessAccount": "<string>",
  "activeAgent": "<string>",
  "defaultRouting": "<string>",
  "defaultWebhook": "<string>",
  "isSandbox": true
}
Sets the number’s default routing to agent and assigns the chosen agent as the active bot. Any webhook subscribed to the number is dropped — call POST /phone-numbers/{number}/subscribe/ to route to a webhook instead. When applyToExisting is true, the new agent is written onto every existing conversation on this number and the in-flight session is cleared so the new agent picks up from scratch. Phone-number routing changes do not dispatch subscription.activated / subscription.revoked webhook events. The agent must already be owned by or shared with the requesting user. Sandbox numbers scope the change to the requesting user’s own conversation: their activeAgent is set to the chosen agent and their conversation routing is forced to agent so the agent flow runs for them. Other users on the shared sandbox are unaffected.

Authorizations

X-API-Key
string
header
required

API key authentication. Pass your API key in the X-API-Key header.

Path Parameters

number
string
required

Body

application/json

Serializer for WhatsappNumber model.

number
string
required
Maximum string length: 15
whatsappPhoneNumberId
string
required

Response

200 - application/json

Serializer for WhatsappNumber model.

id
string<uuid>
required
read-only
number
string
required
Maximum string length: 15
whatsappPhoneNumberId
string
required
whatsappBusinessAccount
string
required
read-only
activeAgent
string
required
read-only
defaultRouting
string
required
read-only
defaultWebhook
string
required
read-only
isSandbox
boolean
required
read-only