POST
/v1/convai/agent-testing/create
ElevenLabs APICreate Agent Response Test
- Base URL
- https://api.elevenlabs.io
- Auth
- xi-api-key: <ELEVENLABS_API_KEY>
- Last verified
- 2026-09-03 · upstream hash matched
Actions
Agents: curl -H "Accept: text/markdown" this URL
→ 211 tokens · Vary: Accept
→ 211 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": "string", "agent_id": "string", "branch_id": "string", "workflow_node_id": "string", "original_agent_reply": [] }, "dynamic_variables": {}, "chat_history": [ { "role": "user", "agent_metadata": { "agent_id": "string", "branch_id": "string", "workflow_node_id": "string", "version_id": "string" }, "message": "string", "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": "string", "tool_name": "string", "params_as_json": "string", "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": "string", "tool_name": "string", "result_value": "string", "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": "string", "producing_llm": "string", "time_in_call_secs": 0, "conversation_turn_metrics": { "metrics": {}, "convai_asr_provider": "string", "convai_tts_model": "string", "convai_tts_cascade": "string" }, "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": "string", "rag_latency_secs": 0, "used_chunk_ids": [ "string" ] }, "llm_usage": { "model_usage": {} }, "interrupted": false, "ignored_as_backchannel": false, "original_message": "string", "reasoning": [ { "summary": "string", "provider_redact": false } ], "source_medium": "audio", "source_event_id": 0, "used_static_kb_document_ids": [ "string" ], "user_identifier": "string", "id": "string", "triggered_guardrails": [ { "guardrail_type": "custom", "guardrail_name": "string" } ] } ], "conversation_initiation_source": "unknown", "environment": "string", "type": "llm", "success_condition": "", "success_examples": [ { "response": "string", "type": "string" } ], "failure_examples": [ { "response": "string", "type": "string" } ], "name": "string", "parent_folder_id": "string"}'Get a free ElevenLabs API key → sponsored
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"
}