POST
POST /v1/convai/agent-testing/create — ElevenLabs API
ElevenLabs APICreate Agent Response Test
- Base URL
- https://api.elevenlabs.io
- Auth
- xi-api-key: <ELEVENLABS_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 224 tokens · Vary: Accept
→ 224 tokens · Vary: Accept
Critical gotchas
Authentication uses the non-standard xi-api-key header, not Authorization: Bearer. Sending a Bearer token returns HTTP 401.
Text-to-speech responses are raw binary audio, not JSON. Write the body to a file (--output speech.mp3) rather than parsing it.
cURL
curl -X POST 'https://api.elevenlabs.io/v1/convai/agent-testing/create' \ -H "xi-api-key: $ELEVENLABS_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "from_conversation_metadata": { "conversation_id": "example-conversation-id", "agent_id": "example-agent-id", "branch_id": "example-branch-id", "workflow_node_id": "example-workflow-node-id", "original_agent_reply": [] }, "dynamic_variables": {}, "chat_history": [ { "role": "user", "agent_metadata": { "agent_id": "example-agent-id", "branch_id": "example-branch-id", "workflow_node_id": "example-workflow-node-id", "version_id": "example-version-id" }, "message": "example-message", "multivoice_message": { "parts": [ { "text": "[recursive or deeply nested schema]", "voice_label": "[recursive or deeply nested schema]", "time_in_call_secs": "[recursive or deeply nested schema]" } ] }, "tool_calls": [ { "type": "system", "request_id": "example-request-id", "tool_name": "example-tool-name", "tool_id": "example-tool-id", "params_as_json": "example-params-as-json", "tool_has_been_called": true, "tool_details": { "type": "[recursive or deeply nested schema]", "method": "[recursive or deeply nested schema]", "url": "[recursive or deeply nested schema]", "headers": "[recursive or deeply nested schema]", "path_params": "[recursive or deeply nested schema]", "query_params": "[recursive or deeply nested schema]", "body": "[recursive or deeply nested schema]" } } ], "tool_results": [ { "request_id": "example-request-id", "tool_name": "example-tool-name", "result_value": "example-result-value", "is_error": true, "is_blocked": false, "tool_has_been_called": true, "tool_latency_secs": 0, "error_type": "", "raw_error_message": "", "dynamic_variable_updates": [ "[recursive or deeply nested schema]" ], "type": "client" } ], "feedback": { "score": "like", "time_in_call_secs": 0 }, "llm_override": "example-llm-override", "producing_llm": "example-producing-llm", "time_in_call_secs": 0, "conversation_turn_metrics": { "metrics": {}, "convai_asr_provider": "example-convai-asr-provider", "convai_tts_model": "example-convai-tts-model", "convai_tts_cascade": "example-convai-tts-cascade", "voice_id": "example-voice-id" }, "rag_retrieval_info": { "chunks": [ { "document_id": "[recursive or deeply nested schema]", "chunk_id": "[recursive or deeply nested schema]", "vector_distance": "[recursive or deeply nested schema]" } ], "embedding_model": "e5_mistral_7b_instruct", "retrieval_query": "example-retrieval-query", "rag_latency_secs": 0, "used_chunk_ids": [ "example-used-chunk-ids" ] }, "llm_usage": { "model_usage": {} }, "interrupted": false, "ignored_as_backchannel": false, "platform_event": "user_turn_timeout", "original_message": "example-original-message", "reasoning": [ { "summary": "example-summary", "provider_redact": false } ], "source_medium": "audio", "source_event_id": 0, "used_static_kb_document_ids": [ "example-used-static-kb-document-ids" ], "user_identifier": "example-user-identifier", "id": "example-id", "triggered_guardrails": [ { "guardrail_type": "custom", "guardrail_name": "example-guardrail-name" } ] } ], "conversation_initiation_source": "unknown", "environment": "example-environment", "type": "llm", "success_condition": "", "success_examples": [ { "response": "example-response", "type": "example-type" } ], "failure_examples": [ { "response": "example-response", "type": "example-type" } ], "name": "example-name", "parent_folder_id": "parent-folder-id"}'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| from_conversation_metadata | body | object | No | Metadata of a conversation this test was created from (if applicable). |
| dynamic_variables | body | object | No | Dynamic variables to replace in the agent config during testing |
| chat_history | body | object[] | No | Request body field chat_history. |
| conversation_initiation_source | body | string | No | Simulate the test as if the conversation originated from this channel. |
| environment | body | string | No | The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. |
| type | body | string | No | Request body field type. |
| success_condition | body | string | No | A prompt that evaluates whether the agent's response is successful. Should return True or False. |
| success_examples | body | object[] | No | Non-empty list of example responses that should be considered successful |
| failure_examples | body | object[] | No | Non-empty list of example responses that should be considered failures |
| name | body | string | Yes | Request body field name. |
| parent_folder_id | body | string | No | The ID of the parent folder. If not provided, the test will be created at the root level. |
Response 200 OK
{
"id": "string"
} Get a free ElevenLabs API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.