Skip to main content

AI Voice Agent Errors and Security

AI Voice Agent APIs use the standard MiniVoice bearer API key. The API key scopes every request to one customer. Do not send customer_id in public AI requests; the public create and update handlers reject unsupported configuration fields.

Authentication​

curl -sS https://api.minivoice.eu/v1/ai/agents \
-H 'Authorization: Bearer $MINIVOICE_API_KEY'

Missing or invalid authentication returns the standard unauthorized response for customer AI routes.

{
"error": {
"code": "unauthorized",
"message": "unauthorized"
}
}

Common Error Codes​

CodeHTTP statusMeaning
invalid_json400Request body was not valid JSON.
unsupported_field400Request included an internal or unsupported field.
invalid_ai_agent400Agent validation failed.
invalid_model400Model is not in the public allowlist.
invalid_voice400Voice is not in the public allowlist.
ai_agent_not_found404Agent was not found for the authenticated customer.
agent_id_required400Outbound AI call was missing agent_id.
ai_agent_not_available400Agent does not exist, does not belong to the customer, or is inactive.
invalid_to400to is not a valid E.164 number.
invalid_from400from is missing, invalid, or not owned by the customer.
insufficient_balance402Customer balance is too low to create an AI call.
concurrent_call_limit_reached429Customer concurrent call limit was exceeded.
cps_limit_reached429Customer calls-per-second limit was exceeded.
no_active_trunk400No active outbound trunk is configured.
originate_failed502Outbound originate failed before answer.

Validation Limits​

FieldLimit
nameRequired on create, at most 120 characters.
greetingAt most 500 characters.
instructionsAt most 8000 characters.
descriptionAt most 1000 characters.
fallback_messageAt most 500 characters.
hangup_tool_descriptionAt most 1000 characters.
transfer_tool_descriptionAt most 1000 characters.
max_turns1 to 20.
max_call_seconds30 to 1800.
silence_timeout_ms1000 to 15000.
turn_recording_max_seconds2 to 30.
max_turn_latency_ms1000 to 60000.
outbound call contextJSON object, at most 4096 bytes before storage wrapping.
transfer_destinationsAt most 10 destinations.

Unsupported Field Example​

curl -sS https://api.minivoice.eu/v1/ai/agents \
-X POST \
-H 'Authorization: Bearer $MINIVOICE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"customer_id": "cust_123",
"name": "Bad Request"
}'
{
"error": {
"code": "unsupported_field",
"message": "unsupported AI agent field"
}
}

Security Guidance​

Store API keys server-side. Do not place MiniVoice API keys in browsers, mobile apps, or public repositories. Verify webhook signatures before parsing webhook JSON. For outbound AI calls, pass only the context needed for the conversation and keep it under the documented size limit.

Testing​

Add negative API tests for invalid JSON, invalid model, invalid voice, paused agent usage, missing balance, invalid from, and oversized context. Your client should preserve the MiniVoice error.code because it is more stable for branching than the human-readable message.