clientnexus_71205
11/28/2025, 9:19 AMAI Evy
11/28/2025, 9:20 AMAI Evy
11/28/2025, 9:21 AMPOST /create-agent [(1) ]()
- Purpose: Create a new agent
### Update Agent
- Endpoint: PATCH /update-agent/{agent_id} [(2) ]()
- Purpose: Update an existing agent's latest draft version
### Get Agent Versions
- Endpoint: GET /get-agent-versions/{agent_id} [(3) ]()
- Purpose: Get all versions of an agent
---
## 2. REQUIRED FIELDS & FORMATS
### Create Agent - Required Fields [(1) ]()
Minimum Required:
- response_engine (object, required)
- voice_id (string, required)
response_engine Object Structure:
json
{
"type": "retell-llm",
"llm_id": "llm_234sdertfsdsfsdf",
"version": 0
}AI Evy
11/28/2025, 9:21 AM"everything" |
| opt_in_signed_url | boolean | Optional | true |
| pronunciation_dictionary | object[] \| null | Optional | See below |
| normalize_for_speech | boolean | Optional | true |
| end_call_after_silence_ms | integer | Min 10000, default 600000 | 600000 |
| max_call_duration_ms | integer | Min 60000, max 7200000, default 3600000 | 3600000 |
| voicemail_option | object \| null | Optional | See below |
| post_call_analysis_data | object[] \| null | Optional | See below |
| post_call_analysis_model | enum\ | Default "gpt-4o-mini" | "gpt-4o-mini" |
| begin_message_delay_ms | integer | Range [0,5000], default 0 | 1000 |
| ring_duration_ms | integer | Range [5000,90000], default 30000 | 30000 |
| stt_mode | enum\ | Default "fast" | "fast" |
| vocab_specialization | enum\ | Default "general" | "general" |
| allow_user_dtmf | boolean | Default true | true |
| user_dtmf_options | object \| null | Optional | See below |
| denoising_mode | enum\ | Default "noise-cancellation" | "noise-cancellation" |
| pii_config | object | Optional | See below |
---
## 4. COMPLETE PAYLOAD EXAMPLES
### CREATE Agent - Minimal PayloadAI Evy
11/28/2025, 9:21 AMresponse_engine | object | Required for create [(1) ]() | See above |
| voice_id | string | Required for create | "11labs-Adrian" |
| agent_name | string \| null | Optional | "Jarvis" |
| voice_model | enum\ \| null | Optional | "eleven_turbo_v2" |
| fallback_voice_ids | string[] \| null | Optional | ["openai-Alloy", "deepgram-Angus"] |
| voice_temperature | number | Range [0,2], default 1 | 1 |
| voice_speed | number | Range [0.5,2], default 1 | 1 |
| volume | number | Range [0,2], default 1 | 1 |
| responsiveness | number | Range [0,1], default 1 | 1 |
| interruption_sensitivity | number | Range [0,1], default 1 | 1 |
| enable_backchannel | boolean | Optional | true |
| backchannel_frequency | number | Range [0,1], default 0.8 | 0.9 |
| backchannel_words | string[] \| null | Optional | ["yeah", "uh-huh"] |
| reminder_trigger_ms | number | Positive number, default 10000 | 10000 |
| reminder_max_count | integer | Non-negative, default 1 | 2 |
| ambient_sound | enum\ \| null | Optional | "coffee-shop" |
| ambient_sound_volume | number | Range [0,2], default 1 | 1 |
| language | enum\ | Default "en-US" | "en-US" |
| webhook_url | string \| null | Optional | `" |
| webhook_timeout_ms | integer | Default 10000 | 10000 |
| boosted_keywords | string[] \| null | Optional | ["retell", "kroger"] |
| data_storage_setting | enum\ | Default "eveAI Evy
11/28/2025, 9:21 AMjson
{
"response_engine": {
"type": "retell-llm",
"llm_id": "llm_234sdertfsdsfsdf"
},
"voice_id": "11labs-Adrian"
}
### CREATE Agent - Full Payload ExampleAI Evy
11/28/2025, 9:21 AMjson
{
"response_engine": {
"type": "retell-llm",
"llm_id": "llm_234sdertfsdsfsdf",
"version": 0
},
"voice_id": "11labs-Adrian",
"agent_name": "Jarvis",
"voice_model": "eleven_turbo_v2",
"fallback_voice_ids": ["openai-Alloy", "deepgram-Angus"],
"voice_temperature": 1,
"voice_speed": 1,
"volume": 1,
"responsiveness": 1,
"interruption_sensitivity": 1,
"enable_backchannel": true,
"backchannel_frequency": 0.9,
"backchannel_words": ["yeah", "uh-huh"],
"reminder_trigger_ms": 10000,
"reminder_max_count": 2,
"ambient_sound": "coffee-shop",
"ambient_sound_volume": 1,
"language": "en-US",
"webhook_url": "<https://webhook-url-here%22,>
"webhook_timeout_ms": 10000,
"boosted_keywords": ["retell", "kroger"],
"data_storage_setting": "everything",
"opt_in_signed_url": true,
"pronunciation_dictionary": [
{
"word": "actually",
"alphabet": "ipa",
"phoneme": "ˈæktʃuəli"
}
],
"normalize_for_speech": true,
"end_call_after_silence_ms": 600000,
"max_call_duration_ms": 3600000,
"voicemail_option": {
"action": {
"type": "static_text",
"text": "Please give us a callback tomorrow at 10am."
}
},
"post_call_analysis_data": [
{
"type": "string",
"name": "customer_name",
"description": "The name of the customer.",
"examples": ["John Doe", "Jane Smith"]
}
],
"post_call_analysis_model": "gpt-4o-mini",
"begin_message_delay_ms": 1000,
"ring_duration_ms": 30000,
"stt_mode": "fast",
"vocab_specialization": "general",
"allow_user_dtmf": true,
"user_dtmf_options": {
"digit_limit": 25,
"termination_key": "#",
"timeout_ms": 8000
},
"denoising_mode": "noise-cancellation",
"pii_config": {
"mode": "post_call",
"categories": []
}
}AI Evy
11/28/2025, 9:21 AMvoice_speed, volume, responsiveness, interruption_sensitivity, `backchannel_frequency`**: Must be numbers, not strings [(1) ]() [(2) ]()
- **`reminder_trigger_ms`, reminder_max_count, webhook_timeout_ms, end_call_after_silence_ms, max_call_duration_ms, begin_message_delay_ms, `ring_duration_ms`**: Must be integers, not strings or floats
- **`enable_backchannel`, normalize_for_speech, opt_in_signed_url, `allow_user_dtmf`**: Must be booleans (true/false) , not strings ("true"/"false")
- **`fallback_voice_ids`, backchannel_words, `boosted_keywords`**: Must be arrays of strings, not single strings
- **`response_engine`, voicemail_option, user_dtmf_options, `pii_config`**: Must be objects, not strings
### Range Validation Errors
- **`voice_temperature`, volume, `ambient_sound_volume`**: Must be in range [0,2]
- **`voice_speed`**: Must be in range [0.5,2]
- **`responsiveness`, interruption_sensitivity, `backchannel_frequency`**: Must be in range [0,1]
- **`end_call_after_silence_ms`**: Minimum 10,000
- **`max_call_duration_ms`**: Minimum 60,000, maximum 7,200,000
- **`begin_message_delay_ms`**: Range [0,5000]
- **`ring_duration_ms`**: Range [5000,90000]
### Enum Validation Errors
- **`voice_model`**: Must be one of: "eleven_turbo_v2", "eleven_flash_v2", "eleven_turbo_v2_5", "eleven_flash_v2_5", "eleven_multilingual_v2", "tts-1", "gpt-4o-mini-tts"
- **`ambient_sound`**: Must be one of: "coffee-shop", "convention-hall", "summer-outdoor", "mountain-outdoor", "static-noise", "call-center"
- **`language`**: Must be a valid language code (e.g., "en-US", "es-ES", "multi")
- **`data_sAI Evy
11/28/2025, 9:21 AM"everything", "everything_except_pii", "basic_attributes_only"
- **`stt_mode`**: Must be one of: "fast", "accurate"
- **`vocab_specialization`**: Must be one of: "general", "medical"
- **`denoising_mode`**: Must be one of: "noise-cancellation", "noise-and-background-speech-cancellation"
---
## 6. CORRECT INTEGRATION FLOW
### Step 1: Create Draft in Your Software
- User fills out agent configuration in Lovable UI
- Validate all fields locally before sending to Retell
### Step 2: Create Agent in Retell [(1) ]()AI Evy
11/28/2025, 9:21 AMAI Evy
11/28/2025, 9:21 AMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
response_engine: {
llm_id: 'llm_234sdertfsdsfsdf',
type: 'retell-llm'
},
voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
### Step 3: Save Response Fields
After successful creation, save these fields:
- agent_id (string, required)
- version (integer)
- is_published (boolean)
- last_modification_timestamp (integer)
### Step 4: Update Agent When Publishing [(2) ]()
javascript
const agentResponse = await client.agent.update(
'16b980523634a6dc504898cda492e939',
{ agent_name: 'Jarvis' }
) ;
console.log(agentResponse.agent_id) ;
### Step 5: Verify Agent Creation [(3) ]()
javascript
const agentResponses = await client.agent.getVersions(
'16b980523634a6dc504898cda492e939'
) ;
console.log(agentResponses) ;
---
## 7. API RESPONSE STRUCTURE
### *Successful Creation Response (201) * [(1) ]()
json
{
"agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
"version": 0,
"is_published": false,
"response_engine": {
"type": "retell-llm",
"llm_id": "llm_234sdertfsdsfsdf",
"version": 0
},
"agent_name": "Jarvis",
"voice_id": "11labs-Adrian",
"last_modification_timestamp": 1703413636133
}AI Evy
11/28/2025, 9:21 AMAI Evy
11/28/2025, 12:18 PM/v2/ prefix
Update Agent: [(2) ]()
- Correct: `PATCH
- The endpoint does not use the /v2/ prefix
## Why You're Getting 404
Based on community reports, the most common cause of 404 errors when creating agents is an invalid voice_id [(3) ]() [(4) ]() .
In your payload, you're using:
json
"voice_id": "dNH3PGQenpJn3UgJkJS8"
This appears to be an ElevenLabs voice ID format. Common issues:
1. Voice ID doesn't exist in Retell's system
2. Voice ID format is incorrect - Retell expects voice IDs in the format "11labs-Adrian" not raw ElevenLabs IDs [(1) ]()
## Additional Payload Issue
Your payload includes "begin_message" which is not a valid field in the Create Agent endpoint . The correct field structure doesn't include this parameter in the documented API.
## Recommended Fix
1. Verify your voice_id - Check the Dashboard for the correct voice ID format
2. Remove begin_message from your payload (not a documented field)
3. Test with a known-good voice_id like "11labs-Adrian"
Here's a corrected minimal payload:AI Evy
11/28/2025, 12:18 PMAI Evy
11/28/2025, 12:18 PMjson
{
"agent_name": "Andre",
"voice_id": "11labs-Adrian",
"response_engine": {
"type": "retell-llm",
"llm_id": "llm_7a1ed8294b7d023807687b2ba325",
"version": 0
},
"enable_backchannel": true
}
The community has confirmed that correcting the voice_id format typically resolves 404 errors [(3) ]() [(4) ]() .
**clientnexus_71205
11/28/2025, 12:18 PMAI Evy
11/28/2025, 12:18 PMAI Evy
11/28/2025, 12:18 PMAI Evy
11/28/2025, 3:15 PMAI Evy
11/28/2025, 3:15 PMclientnexus_71205
11/28/2025, 3:15 PMAI Evy
11/28/2025, 3:16 PMAI Evy
11/28/2025, 3:17 PMAI Evy
11/28/2025, 3:24 PMAI Evy
11/28/2025, 3:24 PMclientnexus_71205
11/28/2025, 3:24 PMAI Evy
11/28/2025, 3:25 PMAI Evy
11/28/2025, 3:25 PMAI Evy
11/28/2025, 3:30 PMclientnexus_71205
11/28/2025, 4:48 PMAI Evy
11/28/2025, 4:48 PMAI Evy
11/28/2025, 4:49 PMjson
{
"post_call_analysis_data": [
{
"type": "string",
"name": "customer_name",
"description": "The name of the customer.",
"examples": ["John Doe", "Jane Smith"]
}
],
"post_call_analysis_model": "gpt-4o-mini"
}
The call_analyzed webhook event is triggered when call analysis is complete and includes the full call_analysis object [(1) ]() .
---
API Response & Call Status
1. Checking Call Status via API
You can retrieve call information using the Get Call endpoint [(4) ]() :
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponse = await client.call.retrieve('call_id_here') ;
console.log(callResponse.call_status) ;
2. Call Status Values
The call_status field can have the following values [(5) ]() [(4) ]() :
- "registered" - Call has been registered
- Additional statuses are available after the call progresses [(4) ]()
3. Available Call Data
After a call ends, you can access :
- transcript - Transcription of the call
- recording_url - Recording of the call
- recording_multi_channel_url - Recording with each party's audio in separate channels
- call_analysis - Post-call analysis including sentiment, summary, and custom data
- disconnection_reason - The reason for call disconnection
4. Webhook Payload Example
When call_ended is triggered, you'll receive a payload like this [(1) ]() :AI Evy
11/28/2025, 4:49 PMcall_started - Triggered when a new call begins
- call_ended - Triggered when a call completes, transfers, or encounters an error
- call_analyzed - Triggered when call analysis is complete
Important: If the call did not connect (like dial_failed) , the call_started webhook event will not be triggered . However, call_ended and call_analyzed webhooks will still be triggered .
3. Webhook Behavior
The webhook will POST the payload to your endpoint with a timeout of 10 seconds . If no success status (2xx) is received within 10 seconds, the webhook will be retried up to 3 times . Webhooks are triggered in order but are not blocking .
---
Call Recording & Transcription
1. Recording Configuration
Recording is controlled by the data_storage_setting field in your agent configuration [(3) ]() :
- "everything" - Stores all data including transcripts, recordings, and logs
- `"everything_except_pAI Evy
11/28/2025, 4:49 PM"basic_attributes_only" - Stores only basic attributes; no transcripts/recordings/logs
The default value is "everything" .
2. Post-Call Analysis
Post-call analysis is configured using the post_call_analysis_data field when creating or updating an agent . Example configuration:AI Evy
11/28/2025, 4:49 PMjson
{
"event": "call_ended",
"call": {
"call_type": "phone_call",
"from_number": "+12137771234",
"to_number": "+12137771235",
"direction": "inbound",
"call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
"agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
"call_status": "registered",
"metadata": {},
"retell_llm_dynamic_variables": {
"customer_name": "John Doe"
},
"start_timestamp": 1714608475945,
"end_timestamp": 1714608491736,
"disconnection_reason": "user_hangup",
"transcript": "...",
"opt_out_sensitive_data_storage": false
}
}
---
Verification Steps
To verify your setup:
1. Check webhook registration in your Retell dashboard (system settings or agent detail page) [(2) ]()
2. Verify all three events are enabled (call_started, call_ended, call_analyzed) [(1) ]()
3. Confirm data_storage_setting is not set to "basic_attributes_only" if you need recordings [(3) ]()
4. Test your webhook endpoint locally using the provided curl command [(2) ]()
5. Make a test call and check the Retell dashboard for call status
6. Verify webhook delivery by checking your endpoint logs for incoming POST requests [(1) ]()AI Evy
11/28/2025, 4:49 PMAI Evy
11/28/2025, 4:49 PMclientnexus_71205
11/28/2025, 5:08 PMAI Evy
11/28/2025, 5:08 PMAI Evy
11/28/2025, 5:09 PMAI Evy
11/28/2025, 5:09 PMbash
curl --location 'localhost:8080/webhook' \
--header 'Content-Type: application/json' \
--data '{
"event": "call_ended",
"call": {
"call_type": "phone_call",
"from_number": "+12137771234",
"to_number": "+12137771235",
"direction": "inbound",
"call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
"agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
"call_status": "registered",
"metadata": {},
"retell_llm_dynamic_variables": {
"customer_name": "John Doe"
},
"start_timestamp": 1714608475945,
"end_timestamp": 1714608491736,
"disconnection_reason": "user_hangup",
"transcript": "...",
"opt_out_sensitive_data_storage": false
}
}'AI Evy
11/28/2025, 5:10 PMAI Evy
11/28/2025, 5:10 PMclientnexus_71205
11/28/2025, 5:14 PMAI Evy
11/28/2025, 5:14 PMAI Evy
11/28/2025, 5:15 PM1427703 from `
3. Get your Cal.com API Key from Settings → Developer → API Keys
4. Add the "Check Availability" function in Retell with these credentials [(1) ]() [(2) ]()
The function checks availability based on pre-scheduled intervals that users can see [(2) ]() .
### 2. Event Creation Requests (Required Fields)
To book appointments, Retell AI uses Cal.com's Book Appointment function [(1) ]() [(2) ]() [(3) ]() . Required setup:
Required Fields:
- Cal.com API Key [(1) ]()
- Event Type ID
- Email address (configured as {{scheduling_email}}) [(4) ](AI Evy
11/28/2025, 5:15 PM{{clinic_phone_number}})
Timezone Handling:
- Configure timezone in both the Cal.com function settings and the Cal.com platform itself [(2) ]() [(4) ]()
- Use the {{current_time}} dynamic variable in your prompt before triggering availability check and book functions to avoid timezone conflicts [(4) ]()
Duration:
- Duration is determined by the Event Type configuration in Cal.com (e.g., 30-minute consultation calls) [(1) ]()
### 3. Handling Scheduling Conflicts
Retell AI's integration automatically validates conflicts through Cal.com's availability checking [(1) ]() [(2) ]() [(3) ]() . The recommended flow is:
1. Check availability first using the check_calendar_availability function [(4) ]()
2. Present available slots to the user
3. Book the appointment only after confirming an available slot
The system returns errors like {"error":"Time range is in the past"} when conflicts occur .
### 4. Multi-User Calendars and Multi-Tenant Support
For managing multiple calendars (e.g., multiple closers with different calendars) , you have options [(5) ]() :
Option 1: Cal.com Round Robin
- Use Cal.com's built-in round robin feature
Option 2: Multiple Calendar Functions
- Set up distinct calendars in Cal.com for each user
- Create separate "Check Availability" fuAI Evy
11/28/2025, 5:15 PMAI Evy
11/28/2025, 5:15 PMWhen user stated a time range, please check the calendar availability by calling the `check_calendar_availability` function and let user know whether that range work or not.AI Evy
11/28/2025, 5:15 PM{{current_time}} in your prompt before both calendar functions to ensure accurate timezone handling [(4) ]()
4. After availability is confirmed, trigger the book_appointment function
Why this matters: The booking endpoint does not automatically validate conflicts—you must check availability first to prevent booking errors .
### Architecture Alignment Recommendations
1. Timezone Synchronization: Ensure your calendar system's timezone matches both the Cal.com platform settings and the Retell AI function configuration [(2) ]() [(4) ]()
2. Multi-Turn Conversations: Retell AI's agents maintain context across multiple exchanges, allowing natural back-and-forth during scheduling [(7) ]()
3. Prompt Engineering: Be explicit about when to invoke calendar functions in your agent's prompt [(1) ]() [(8) ]()
4. Error Handling: Monitor for timezone-related errors where bookings occur on different days than requested—this typically indicates timezone misalignment [(4) ]()
5. State Management: For complex scheduling flows, consider using Multi-Prompt agents with separate states for qualification and booking [(9) ]()
---
**AI Evy
11/28/2025, 5:15 PMAI Evy
11/28/2025, 5:16 PMclientnexus_71205
11/28/2025, 5:36 PMAI Evy
11/28/2025, 5:36 PMAI Evy
11/28/2025, 5:36 PMeventTypeId to use:
## *Hardcoded per Agent (Current Default) *
The Cal.com integration currently requires you to specify the Event Type ID during function setup/configuration [(1) ]() . This means:
1. When you add the "Check Calendar Availability" function in Retell, you must provide:
- Cal.com API Key
- Event Type ID
- Tool description
- (Optional) timezone
2. The Event Type ID is obtained from your Cal.com URL (e.g., 1427703 from `
3. This configuration is set at the agent level, meaning each agent's calendar function is tied to a specific Event Type ID
## Dynamic Selection Not Currently Supported
According to community discussions, dynamic Event Type ID selection by the AI agent is not currently supported [(2) ]() . If you need the agent to dynamically specify different event type IDs (e.g., to check availability or book appointments to different calendars) , you would need to implement custom functions .
## Workaround for Multiple Calendars
If you need to manage multiple calendars with different Event Type IDs, you have two options:
1. Create separate calendar functions for each Event Type ID, then use explicit prompt instructions to guide the agent on which function to use [(3) ]()
2. Implement custom functions with your own backend that can handle dynamic Event Type ID selection [(2) ]()
The Cal.com integration implementation is not currently open-source , so for advanced use cases requiring dynamic variables as keys andAI Evy
11/28/2025, 5:36 PMAI Evy
11/28/2025, 5:36 PMAI Evy
11/28/2025, 5:36 PM