Skip to main content

Outbound AI Voice Calls

Use POST /v1/ai/calls to start an outbound call handled by an AI Voice Agent. This is separate from regular outbound calls. The request names the agent, destination number, caller ID, and optional context for that specific conversation.

Endpoint​

EndpointMethodAuth
/v1/ai/callsPOSTRequired

Request​

curl -sS https://api.minivoice.eu/v1/ai/calls \
-X POST \
-H 'Authorization: Bearer $MINIVOICE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"agent_id": "agent_20260707T120000.000000000",
"from": "+15551230002",
"to": "+15551230001",
"context": {
"customer_name": "Jordan Lee",
"appointment_time": "2026-07-08T15:30:00Z",
"reason": "appointment confirmation"
}
}'

Response​

{
"data": {
"call_id": "call_20260707T120500.000000000",
"ai_session_id": "agent_session_20260707T120500.000000000",
"agent_id": "agent_20260707T120000.000000000",
"status": "dialing",
"runtime_type": "auto",
"media_mode": "turn_based",
"created_at": "2026-07-07T12:05:00Z"
}
}

Parameters​

FieldTypeRequiredDescription
agent_idstringyesActive AI agent owned by the authenticated customer.
tostringyesDestination phone number in E.164 format.
fromstringyesCustomer-owned active DID in E.164 format.
contextobjectnoFreeform JSON object for the conversation. Raw context must fit within 4096 bytes before MiniVoice stores it under ai_context.

Validation​

MiniVoice validates that the agent exists, belongs to the authenticated customer, is active, and is not deleted. from must be an active DID owned by the customer. The customer must have positive balance, must not exceed concurrent-call or calls-per-second limits, and must have an active outbound trunk. If originate fails before answer, the API returns a 502 with originate_failed and includes the call_id.

Context Use Case​

For appointment confirmations, keep the agent reusable and pass appointment-specific data in context.

{
"context": {
"customer_name": "Jordan Lee",
"appointment_time": "2026-07-08T15:30:00Z",
"location": "Downtown Clinic",
"confirmation_goal": "Ask whether the customer can still attend."
}
}

The runtime uses this context as part of the session prompt. Unknown customer fields are accepted as long as the context is a JSON object and remains within the size limit.

Common Errors​

{
"error": {
"code": "invalid_from",
"message": "from must belong to this customer"
}
}
{
"error": {
"code": "insufficient_balance",
"message": "balance is too low to create AI call"
}
}
{
"error": {
"code": "no_active_trunk",
"message": "no active outbound trunk configured"
}
}

Testing​

Start with a test DID that belongs to your customer and an active outbound trunk. Create an agent that says it is a test call, then call your own mobile number. Verify the immediate response has status set to dialing, then fetch the returned ai_session_id from GET /v1/ai/sessions/:id after the call ends.