Client Nexus
12/23/2025, 7:59 PMAI Evy
12/23/2025, 7:59 PMAI Evy
12/23/2025, 7:59 PMfrom_number | string (E.164) | Your Retell-managed or imported number |
| to_number | string (E.164) | Destination number |
| override_agent_id | string | Override the agent used for this call (optional) |
| metadata | object | Free-form metadata stored with the call |
| retell_llm_dynamic_variables | object | Key–value strings injected into prompts/tools |
[(1) ]()
## API Example for Campaign Calls
javascript
const registerCallResponse = await retell.call.createPhoneCall({
from_number: '+14157774444', // replace with the number you purchased
to_number: '+12137774445', // replace with the number you want to call
// Optional: per-call agent selection and overrides
override_agent_id: 'agent_abc123',
override_agent_version: 0, // or omit to use latest
agent_override: {
agent: {
voice_speed: 1.1,
enable_backchannel: true,
},
// retell_llm or conversation_flow overrides are also supported
},
retell_llm_dynamic_variables: { // dynamic variables (optional, string values only)
name: 'John Doe',
blood_group: 'B+'
},
custom_sip_headers: { // replace with custom sip headers you want to send (optional)
X-Custom-Header: 'Custom Value'
}
}) ;AI Evy
12/23/2025, 7:59 PMText, Number, Enum, or Boolean
3. Update your prompt to specify when to extract, e.g.:
When user states his name and phone number, please extract the information by calling the `extract_user_details` function.
## For Batch/Campaign Calling
For high-volume campaigns, check out the [Batch Calling Guide](/deploy/make-batch-call) referenced in the docs for uploading contact lists and scheduling. [(1) ]()
---AI Evy
12/23/2025, 8:00 PMAI Evy
12/23/2025, 8:00 PMClient Nexus
12/24/2025, 5:40 PMAI Evy
12/24/2025, 5:40 PMAI Evy
12/24/2025, 5:41 PMfirst_name can be referenced as {{first_name}}) . [(2) ]()
## API Example
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const batchCallResponse = await client.batchCall.createBatchCall({
from_number: '+14157774444',
tasks: [{ to_number: '+12137774445' }],
}) ;
console.log(batchCallResponse.batch_call_id) ;
[(3) ]()
## When to Use Individual API Calls
Individual calls via the Create Phone Call API are better suited for:
- Single, on-demand outbound calls
- Real-time triggered calls (e.g., user action triggers a callback)
For high-volume campaign use cases, Batch Calling handles the queuing and rate limiting for you, so you don't have to manage concurrency in your own loop.AI Evy
12/24/2025, 5:41 PMAI Evy
12/24/2025, 5:41 PMClient Nexus
12/24/2025, 5:42 PMAI Evy
12/24/2025, 5:42 PMAI Evy
12/24/2025, 5:42 PMjavascript
npm i retell-sdk
[(1) ]()
## 2. Initialize the Client
javascript
import Retell from 'retell-sdk';
const retellClient = new Retell({
apiKey: "YOUR_API_KEY",
}) ;
## 3. Phone Number Setup
Your from_number must be a phone number you've purchased and configured through Retell AI. [(2) ]()
To create/configure a phone number:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.create() ;
console.log(phoneNumberResponse.inbound_agent_id) ;
To update an existing number with an outbound agent:
javascript
const phoneNumberResponse = await client.phoneNumber.update('+14157774444', {
inbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
nickname: 'Frontdesk Number',
outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
[(3) ]()
## 4. Create Batch Calls (Recommended for Campaigns)
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) ;
For dynamic variables and agent overrides, use this payload structure:
json
{
"from_number": "+16504144521",
"to_number": "your_target_number",
"override_agent_id": "agent_71724df7636716ceb3a7e244c8",
"retell_llm_dynamic_variables": {
"name": "Sarah"
}
}AI Evy
12/24/2025, 5:42 PMcall_started | Triggered when a new call begins | Basic call information |
| call_ended | Triggered when a call completes, transfers, or encounters an error | All fields from the call object except call_analysis |
| call_analyzed | Triggered when call analysis is complete | Full call data including call_analysis object |
Sample webhook payload:
json
{
"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": "...",
"transcript_object": [ [Object], [Object], [Object], [Object] ],
"transcript_with_tool_calls": [ [Object], [Object], [Object], [Object] ],
"opt_out_sensitive_data_storage": false
}
}AI Evy
12/24/2025, 5:42 PMfrom_number must be purchased and configured through Retell AI [(2) ]()
2. The phone number should have an outbound_agent_id configured, or use override_agent_id in your request
3. Use retell_llm_dynamic_variables (not custom_data) for passing variables
For more detailed SDK examples, check out:
- [Node.js SDK Examples]() [(1) ]()
- [Python SDK Examples]()
---AI Evy
12/24/2025, 5:43 PMAI Evy
12/24/2025, 5:43 PMClient Nexus
12/24/2025, 5:48 PMAI Evy
12/24/2025, 5:48 PMAI Evy
12/24/2025, 5:48 PMAI Evy
12/24/2025, 5:48 PMAI Evy
12/24/2025, 5:48 PMClient Nexus
12/24/2025, 6:32 PMAI Evy
12/24/2025, 6:32 PMAI Evy
12/24/2025, 6:32 PMPOST /create-batch-call
[(1) ]()
Your payload references `/v2/create-batch-call`—verify this matches the current API base URL in the SDK or docs.
## Required Parameters
Your payload includes the required fields:
- from_number (E.164 format) ✓
- tasks array with to_number ✓
## Supported Task Fields
Based on the API reference, each task object supports:
- to_number ✓
Your use of retell_llm_dynamic_variables and metadata within tasks aligns with how dynamic variables work for personalization. [(2) ]()
## Optional Parameters You May Want to Consider
The API also supports: [(1) ]()
- name – for your own reference ✓ (you have this)
- trigger_timestamp – to schedule calls for a future time
- reserved_concurrency – reserve a portion of your org concurrency for batch processing
- call_time_window – define allowed calling windows in a specific timezone
## One Limitation to Note
A Discord user asked about overriding the default agent ID per phone number within a batch request, which suggests override_agent_id at the batch level (as you're doing) is the standard approach—there's no documented way to assign different agents per task within the same batch. [(3) ]()
## Tracking Batch Status
Once created, batch calls are classified by status: Draft, Planned, Ongoing, or Sent. [(2) ]()
Metrics available include: Sent, Picked Up, and Successful calls.AI Evy
12/24/2025, 6:32 PMAI Evy
12/24/2025, 6:32 PMClient Nexus
12/24/2025, 7:00 PMAI Evy
12/24/2025, 7:00 PMAI Evy
12/24/2025, 7:01 PMoutbound_agent_id field on the phone number determines which agent is used for outbound calls when no override is provided. [(1) ]()
If outbound_agent_id is null, the number would not be able to initiate outbound calls without an agent id override.
## Programmatic Solution for Multiple Users
Since you have multiple users, you can automate the phone number configuration via the Update Phone Number API:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneNumberResponse = await client.phoneNumber.update('+14157774444', {
inbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
nickname: 'Frontdesk Number',
outbound_agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
console.log(phoneNumberResponse.inbound_agent_id) ;
## Suggested Workflow
1. When a new phone number is created or imported for a user, immediately call the Update Phone Number API to set the outbound_agent_id
2. You can also set this during phone number creation by passing outbound_agent_id in the Create Phone Number request [(2) ]()
This way, each user's phone number is automatically configured for outbound calls without manual dashboard intervention.AI Evy
12/24/2025, 7:01 PMAI Evy
12/24/2025, 7:01 PMClient Nexus
12/24/2025, 7:10 PMAI Evy
12/24/2025, 7:11 PMAI Evy
12/24/2025, 7:11 PMcall_started | Triggered when a new call begins | Basic call information |
| call_ended | Triggered when a call completes, transfers, or encounters an error | All fields from the call object except call_analysis |
| call_analyzed | Triggered when call analysis is complete | Full call data including call_analysis object |
## Key Variables for Identifying "No Pick Up" and Other Outcomes
From the call_ended webhook payload, use disconnection_reason to identify call outcomes: [(2) ]()
Relevant values include:
- dial_busy – Line was busy
- dial_failed – Dial failed
- dial_no_answer – No answer
- user_hangup – User hung up
- agent_hangup – Agent ended call
- voicemail_reached – Went to voicemail
## Sample Webhook Payload Structure
json
{
"event": "call_ended",
"call": {
"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": "..."
}
}AI Evy
12/24/2025, 7:11 PMcall_status – registered, ongoing, ended, error
- duration_ms – Call duration in milliseconds
- transcript / transcript_object – Full conversation
- call_analysis – Includes call_summary, user_sentiment, call_successful, in_voicemail, and custom_analysis_data
## Batch Call Metrics
From the dashboard, batch calls show: [(3) ]() , [(4) ]()
- Sent – Total calls dispatched
- Picked Up – Calls answered
- Successful – Completed successfully
[(3) ]()
## Automation Workflow Suggestion
For multi-step campaigns ("wait 1 day then step 2") :
1. Receive call_ended webhook
2. Check disconnection_reason (e.g., dial_no_answer, dial_busy)
3. Tag the contact in your app and schedule the next batch call using trigger_timestamp (Unix timestamp in milliseconds) [(5) ]()
javascript
const batchCallResponse = await client.batchCall.createBatchCall({
from_number: '+14157774444',
tasks: [{ to_number: '+12137774445' }],
trigger_timestamp: 1735718400000
}) ;AI Evy
12/24/2025, 7:11 PMAI Evy
12/24/2025, 7:11 PM