Map agent or workflow to a phone line
Full URL: POST https://api.kupe.in/api/v1/phone/mapping
Attaches an agent (or workflow) to a phone_numbers row so inbound PSTN on that line reaches the correct assistant. Phone numbers should be provisioned in E.164 where possible (e.g. +91xxxxxxxxxx for India, +1xxxxxxxxxx for the US).
Send exactly one of agent_id or workflow_id.
Authentication: Use x-api-key or Bearer JWT. webhook_url, config_source, and
user_id are optional; when omitted they are set by the server from deployment config and the
authenticated principal (see schema AgentPhoneMappingRequest).
Response payload: webhook_url and config_source are internal implementation details and are not
returned by this endpoint.
Authorizations
Kupe dashboard API key for your user.
Body
Link exactly one of agent_id or workflow_id to a phone_number_id.
Server-managed fields: When you authenticate with Bearer or x-api-key, you do not need to send webhook_url, config_source, or user_id. The API derives the inbound voice webhook from the deployment base URL, defaults the config source for standard PSTN/Twilio lines, and uses the authenticated user for ownership checks against the phone row. (Optional body overrides remain supported for internal or legacy clients.)
Response
Mapping created
The response is of type object.