fleck082814
09/02/2025, 5:27 PMAI Evy
09/02/2025, 5:27 PMAI Evy
09/02/2025, 5:28 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponse = await client.call.createPhoneCall({
from_number: '+14157774444',
to_number: '+12137774445',
override_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
retell_llm_dynamic_variables: {
customer_name: 'John Doe'
}
}) ;
Your request body structure is valid, but note these requirements :
- from_number and to_number are required fields and must be in E.164 format
- from_number must be a number purchased from Retell or imported to Retell
- override_agent_id is optional - it overrides the agent for this particular call
- retell_llm_dynamic_variables should contain key-value pairs of strings that inject into your Response Engine prompt
Your JSON structure matches the API specification, but make sure to provide actual values for the required fields and ensure your retell_llm_dynamic_variables values are properly formatted as strings.AI Evy
09/02/2025, 5:28 PMAI Evy
09/02/2025, 5:28 PMfleck082814
09/02/2025, 6:23 PMfleck082814
09/02/2025, 6:23 PMAI Evy
09/02/2025, 6:23 PMAI Evy
09/02/2025, 6:24 PMAI Evy
09/02/2025, 6:24 PMoverride_agent_id parameter to specify which agent to use for the call . The agent contains the response engine configuration, including prompts, which must be set up beforehand through the Create Agent API [(2) ]() [(3) ]() .
Here's the workflow:
1. First create an agent using the Create Agent API:
javascript
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',
}) ;
[(3) ]()
2. Then create the phone call referencing that agent:
javascript
const phoneCallResponse = await client.call.createPhoneCall({
from_number: '+14157774444',
to_number: '+12137774445',
}) ;
[(1) ]()
The agent must be created through the dashboard or the Create Agent API first, as it contains the response engine configuration that defines how the AI will behave during the call [(2) ]() [(3) ]() .AI Evy
09/02/2025, 6:24 PM