https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do i trigger a retell agent with api, and what...
# ❓・ai-evy-support
m
@AI Evy how do i trigger a retell agent with api, and what variables are required that i send it in? please provide example, too
a
Thanks for tagging me @Marlon. I'll look through relevant sources and get back to you shortly.
### Answer To trigger a Retell agent via API, you can create a web call using the Create Web Call endpoint [(1) ]() . Here's the JavaScript example from the documentation:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const webCallResponse = await client.call.createWebCall({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' }) ;
console.log(webCallResponse.agent_id) ;
## Required Variables The only required variable is
agent_id
. However, you can include several optional parameters: - `agent_version`: The version of the agent to use for the call - `metadata`: An arbitrary object for storage purpose only - `retell_llm_dynamic_variables`: Key-value pairs of strings that inject into your Response Engine prompt and tool description ## Dynamic Variables Example For personalized conversations, you can pass dynamic variables [(2) ]() . When creating outbound calls, set your variables in the
retell_llm_dynamic_variables
field :
Copy code
json
{
 "user_name": "John Smith",
 "product_name": "Premium Plan",
 "account_status": "active"
}
All values in
retell_llm_dynamic_variables
must be strings . These variables can be used in your agent's prompt, begin message, tool call descriptions, and other agent configurations . For phone calls, there's also mention of a Create Phone Call endpoint in the Discord discussions, but the specific documentation for that endpoint isn't available in the sources provided [(3) ]() .
​ To learn more, see the sources I considered: [[1] Create Web Call](https://docs.retellai.com/api-references/create-web-call) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Discord message from @dannykimes on 2025-07-29](https://discord.com/channels/1186424376300679209/1294891368505937952/1399582499407003751) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy but dont i need to send in required variables like the users phone number to call, their name, etc?
a
Thanks for the follow-up, @Marlon. I'll get back to you soon.
### Answer For phone calls, yes you need to provide phone numbers as required variables [(1) ]() . Here's the JavaScript example for creating outbound phone calls:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.createPhoneCall({
 from_number: '+14157774444',
 to_number: '+12137774445',
}) ;
console.log(phoneCallResponse.agent_id) ;
## Required Variables for Phone Calls The required variables are : - `from_number`: The number you own in E.164 format (must be purchased from Retell or imported to Retell) - `to_number`: The number to call ## Optional Variables for Personalization For user names and other personalized data, you use the
retell_llm_dynamic_variables
field [(2) ]() [(1) ]() :
Copy code
json
{
 "customer_name": "John Doe"
}
[(1) ]() Dynamic variables can be used in your agent's prompt, begin message, tool call descriptions, and other configurations [(2) ]() . All values must be strings . The phone number is a required field for the API call itself, while user names and other personal information are passed as dynamic variables that get injected into your agent's responses .
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.