muhammadsaqlain_73001
09/04/2025, 4:12 PMAI Evy
09/04/2025, 4:12 PMAI Evy
09/04/2025, 4:12 PMjavascript
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) ;
When using HTTP requests directly (like in n8n) , make sure you're using POST method and include these headers [(3) ]() :
- Authorization: Bearer YOUR_API_KEY
- Content-Type: application/json
The request body should follow this format :
json
{
"from_number": "+14157774444",
"to_number": "+12137774445",
"override_agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"
}AI Evy
09/04/2025, 4:12 PMAI Evy
09/04/2025, 4:12 PMAI Evy
09/04/2025, 4:12 PMmuhammadsaqlain_73001
09/04/2025, 4:14 PMmuhammadsaqlain_73001
09/04/2025, 4:15 PMAI Evy
09/04/2025, 4:15 PMAI Evy
09/04/2025, 4:16 PMfrom_number parameter requires a number that you own in E.164 format and must be purchased from Retell or imported to Retell [(1) ]() .
2. **A published agent**: Based on the community discussions, unpublished agents can cause API access issues, including 404 errors when trying to retrieve or use them [(2) ]() .
When creating a phone call, the API requires a valid from_number that's properly configured in your account [(1) ]() . If you haven't assigned or purchased a phone number yet, the API won't be able to process your request.
For the agent, while you can use the override_agent_id parameter in your request body , the agent needs to be accessible via the API. Community reports show that unpublished agents sometimes don't appear in API calls, returning "Found agents: 0" and causing 404 errors [(2) ]() .
To resolve this:
1. Purchase or import a phone number through the Retell dashboard
2. Publish your agent
3. Ensure your phone number is properly bound to an agent using the inbound_agent_id or outbound_agent_id parameters [(3) ]() [(4) ]()
You can bind agents to phone numbers when creating [(3) ]() or updating [(4) ]() them using parameters like inbound_agent_id and outbound_agent_id.AI Evy
09/04/2025, 4:16 PMAI Evy
09/04/2025, 4:16 PM