X-API-Key header. The agent
calls from its own number.
Request
{agent_id} is the agent’s ID, e.g. agent_7fK2mQ9xLp3RtV8wYb1N (in the
agent editor, next to its name), or its number.
phone_number and initial_context are sibling fields at the top level
of the body. Don’t put the number inside initial_context - the agent sees
it as {{initial_context.phone_number}} anyway.
Initial Context
initial_context is a JSON object with any contextual data the agent
should have access to. You reference it in prompts via Handle Bars,
i.e. values wrapped in {{ and }}. For the request above, the caller’s
name in prompts is {{initial_context.user.name}}.
Response
workflow_run_id is the call’s ID. Once the call ends, read it with
GET /agents/{agent_id}/conversations/{workflow_run_id} - see
API introduction.
Errors
Agents with a trigger node in their flow also have the older
POST /api/v1/triggers/{trigger_id}/calls address, with the same body and errors.
It keeps working for existing integrations. Build new ones on
/agents/{agent_id}/calls - it needs no trigger node.