Overview
Creates a new outbound phone call. The AI agent will call the specified phone number and handle the conversation based on its configuration.
Calls are billed based on duration. See Pricing for details.
Request
Bearer token for authentication.Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Body Parameters
The phone number to call in E.164 format.Example: +14155551234Constraints:
- Must start with
+ followed by country code
- 10-15 digits total
- Must be a valid, dialable phone number
Your Magpipe phone number to use as caller ID. Must be a number provisioned in your account.Example: +16045551234
UUID of the AI agent to handle the call.Example: c72ea2b8-1234-5678-9abc-def012345678
Optional key-value pairs to attach to the call. Available in webhooks and call logs.Example:{
"customer_id": "cust_123",
"campaign": "follow_up"
}
URL to receive call status webhooks. Overrides account-level webhook settings.Example: https://yourapp.com/webhooks/calls
Response
Whether the call was successfully initiated.
Unique identifier for the call. Use this to track call status.
Initial call status. One of:
initiated - Call is being placed
queued - Call is queued for dialing
The caller ID number used.
The destination phone number.
The agent handling the call.
ISO 8601 timestamp of when the call was created.
Example Request
curl -X POST "https://mtxbiyilvgwhbdptysex.supabase.co/functions/v1/initiate-bridged-call" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+14155551234",
"from": "+16045551234",
"agent_id": "c72ea2b8-1234-5678-9abc-def012345678"
}'
Example Response
{
"success": true,
"call_id": "a1b2c3d4-5678-9012-3456-789012345678",
"status": "initiated",
"from_number": "+16045551234",
"to_number": "+14155551234",
"agent_id": "c72ea2b8-1234-5678-9abc-def012345678",
"created_at": "2024-01-15T10:30:00.000Z"
}
Error Responses
{
"error": {
"code": "INVALID_PHONE_NUMBER",
"message": "The 'to' field must be a valid E.164 phone number"
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired access token"
}
}
{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient account balance to place call"
}
}
{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent with specified ID not found"
}
}
{
"error": {
"code": "NUMBER_NOT_OWNED",
"message": "The 'from' number is not provisioned in your account"
}
}
Call Status Webhook
When the call status changes, a webhook is sent to your configured URL:
{
"event": "call.status_changed",
"call_id": "a1b2c3d4-5678-9012-3456-789012345678",
"status": "completed",
"duration": 125,
"recording_url": "https://storage.magpipe.ai/recordings/...",
"transcript": "Agent: Hello! Caller: Hi there...",
"metadata": {
"customer_id": "cust_123"
},
"timestamp": "2024-01-15T10:32:05.000Z"
}
Call Status Values
| Status | Description |
|---|
initiated | Call request received, dialing |
ringing | Recipient phone is ringing |
in-progress | Call is active |
completed | Call ended normally |
busy | Recipient was busy |
no-answer | No answer after timeout |
failed | Call failed to connect |
canceled | Call was canceled before connecting |
Your Magpipe access token from the dashboard
Destination phone number in E.164 format
Your Magpipe phone number to use as caller ID (agent assigned to this number handles the call)
Purpose of the call (provided to the agent as context)
Goal of the call (provided to the agent as context)
Optional call template ID
Call initiated successfully