Calls

Toggle AI on/off for a phone number (superadmin)

POST
/api/calls/voice-ai/phone-number/toggle

Atomically sets the AI routing legs on a single user-owned phone number. When enabling: imports the number into ElevenLabs (linking to the chosen agent) with per-leg SIP trunk configs pointing at the Sinch Voice API. When disabling: removes it from ElevenLabs. Fails fast (without DB writes) if the selected agent isn't synced to ElevenLabs or if provider-side operations error - preventing silent drift. Superadmin only.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/calls/voice-ai/phone-number/toggle" \  -H "Content-Type: application/json" \  -d '{    "phoneNumber": "+14165550100",    "routing": {      "inbound": {        "ai": true      },      "outbound": {        "ai": true      }    },    "aiAgentId": "64f0a1b2c3d4e5f6a7b8cc00"  }'
{  "success": true,  "message": "Configuration saved"}