https://retellai.com/?utm_source=discord&utm_medium=seo logo
is this body of post request still updated as per ...
# ❓・ai-evy-support
f
@AI Evy is this body of post request still updated as per latest documentation to trigger a call? { "from_number": "", "to_number": "", "override_agent_id": "", "retell_llm_dynamic_variables": { "first_name": , "custom_variable1": } }
a
Thanks for tagging me @fleck082814. I'll look through relevant sources and get back to you shortly.
### Answer Looking at the documentation, your request body structure is mostly correct but has some issues. Based on the Create Phone Call API documentation [(1) ]() , here's the correct structure:
Copy code
javascript
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.
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
f
Is it possible to create an outbound call with custom prompt directly from the post request? Or an agent must be created under retell dashboard?
@AI Evy Is it possible to create an outbound call with custom prompt directly from the post request? Or an agent must be created under retell dashboard?
a
Thanks for the follow-up, @fleck082814. I'll get back to you soon.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer Based on the Create Phone Call API documentation, you cannot create an outbound call with a custom prompt directly from the POST request [(1) ]() . An agent must be created first before making phone calls . The Create Phone Call API requires either a default agent or an
override_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:
Copy code
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:
Copy code
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) ]() .
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] Create Agent](https://docs.retellai.com/api-references/create-agent) ​