adekurniawan44_59865
08/04/2025, 2:35 AMAI Evy
08/04/2025, 2:35 AMAI Evy
08/04/2025, 2:35 AMagent_id in the body, but the API expects override_agent_id [(1) ]() . The from_number must be a number you own in Retell (purchased from Retell or imported to Retell) .
2. Invalid Parameters:
The parameter user_id doesn't exist in the Create Phone Call API . Remove it from your request.
3. Correct Format:
Here's the proper JavaScript SDK example from the documentation:
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) ;
4. Required Body Parameters:
The API requires from_number and to_number as required parameters . Optional parameters include override_agent_id, metadata, and retell_llm_dynamic_variables .
5. Phone Number Requirements:
The from_number must be a number purchased from Retell or imported to Retell . If using a number purchased from Retell, only US numbers are supported as destination .
Your corrected curl should look like:
bash
curl -X POST <https://api.retellai.com/v2/create-phone-call> \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+your_retell_number",
"to_number": "+62816712xxx",
"override_agent_id": "agent_30992720c1b23f789bxxxxxxxx",
"metadata": {"service_requested":"Roof Repair"}
}'
Make sure your from_number is a valid Retell phone number you own.AI Evy
08/04/2025, 2:35 AMAI Evy
08/04/2025, 2:35 AMadekurniawan44_59865
08/04/2025, 2:37 AMAI Evy
08/04/2025, 2:37 AMAI Evy
08/04/2025, 2:37 AMbash
curl -X POST <https://api.retellai.com/v2/create-phone-call> \
-H "Authorization: Bearer YOUR_RETELL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+14157774444",
"to_number": "+12137774445",
"override_agent_id": "your_agent_id"
}'
Common fixes for this error:
1. Use backslashes for line continuation - Each line except the last needs a \ at the end
2. Ensure proper spacing - No spaces after the backslashes
3. Quote the JSON properly - Use single quotes around the JSON data
Required parameters from the API documentation:
- `from_number`: Must be a number you own in Retell (E.164 format)
- `to_number`: The number to call (E.164 format)
- `override_agent_id`: Your agent ID (optional override)
Make sure your from_number is a valid Retell phone number you purchased or imported, as the API requires this .AI Evy
08/04/2025, 2:37 AMAI Evy
08/04/2025, 2:37 AMadekurniawan44_59865
08/04/2025, 2:39 AMAI Evy
08/04/2025, 2:39 AMAI Evy
08/04/2025, 2:39 AMbash
curl -X POST <https://api.retellai.com/v2/create-phone-call> -H "Authorization: Bearer YOUR_RETELL_API_KEY" -H "Content-Type: application/json" -d '{"from_number": "+14157774444", "to_number": "+12137774445", "override_agent_id": "your_agent_id"}'
Key requirements from the API documentation:
- `from_number`: Must be a number you own in Retell (E.164 format)
- `to_number`: The number you want to call (E.164 format)
- `override_agent_id`: Your agent ID (optional parameter)
Make sure to replace:
- YOUR_RETELL_API_KEY with your actual API key
- +14157774444 with your Retell phone number
- +12137774445 with the destination number
- your_agent_id with your actual agent ID
The from_number must be a number purchased from Retell or imported to Retell .AI Evy
08/04/2025, 2:39 AMAI Evy
08/04/2025, 2:39 AMadekurniawan44_59865
08/04/2025, 2:41 AMadekurniawan44_59865
08/04/2025, 2:42 AMAI Evy
08/04/2025, 2:42 AMAI Evy
08/04/2025, 2:42 AMbash
curl -X POST "<https://api.retellai.com/v2/create-phone-call%22> -H "Authorization: Bearer YOUR_RETELL_API_KEY" -H "Content-Type: application/json" -d '{"from_number": "+14157774444", "to_number": "+12137774445", "override_agent_id": "your_agent_id"}'
Key fixes:
1. Quote the URL - Put quotes around the entire URL: "<https://api.retellai.com/v2/create-phone-call%22%60>
2. **No invisible characters** - Type the command fresh instead of copying from previous attempts
3. **Proper JSON formatting** - Ensure the JSON in-d` is properly quoted
Required parameters from the API:
- `from_number`: Must be a number you own in Retell (E.164 format)
- `to_number`: The number you want to call (E.164 format)
- `override_agent_id`: Your agent ID (optional parameter)
Make sure your from_number is a valid Retell phone number you purchased or imported .AI Evy
08/04/2025, 2:42 AMAI Evy
08/04/2025, 2:42 AMadekurniawan44_59865
08/04/2025, 2:47 AMAI Evy
08/04/2025, 2:47 AMAI Evy
08/04/2025, 2:48 AMfrom_number isn't a valid Retell phone number. According to the Create Phone Call API documentation, the from_number must be a number you own in E.164 format and must be a number purchased from Retell or imported to Retell [(1) ]() .
Your current from_number "+628167124XX" appears to be an Indonesian number, but the documentation states that if using a number purchased from Retell, only US numbers are supported as destination .
To resolve this issue, you need to:
1. Get a Retell phone number first - You can create one using the Create Phone Number API [(2) ]() :
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',
}) ;
console.log(agentResponse.agent_id) ;
[(3) ]()
Or purchase a phone number with the required parameters including area_code (currently only supports US area codes) [(2) ]() .
2. Use the correct from_number - Replace your Indonesian number with a valid Retell phone number in your curl command.
The Create Phone Call API requires that the from_number parameter be a number you own in E.164 format, and it must be a number purchased from Retell or imported to Retell [(1) ]() . This is why you're getting the "Not Found" error - the API can't find a valid Retell phone number matching your from_number.AI Evy
08/04/2025, 2:48 AMAI Evy
08/04/2025, 2:48 AMadekurniawan44_59865
08/04/2025, 2:49 AMAI Evy
08/04/2025, 2:49 AMAI Evy
08/04/2025, 2:50 AMbash
pip install retell-sdk
2. Initialize the Python client:
python
from retell import Retell
client = Retell(
api_key="YOUR_RETELL_API_KEY",
)
3. Create a phone number using the Python SDK:
According to the Python SDK API documentation, you can use the client.phone_number.create() method [(2) ]() :
python
phone_number_response = client.phone_number.create(
# Add your parameters here
)
4. Alternative approach from the documentation:
The documentation shows you can also create a phone number with specific parameters. From the Node.js example (which follows the same pattern) , you can assign agents to the number [(3) ]() :
javascript
const phoneNumberResponse = await retell.phoneNumber.create({
inbound_agent_id: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", // replace with the agent id you want to assign
outbound_agent_id: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", // replace with the agent id you want to assign
}) ;
console.log(phoneNumberResponse) ;
Important notes:
- Phone numbers are charged at $2 per month
- Currently only US numbers are supported for purchase from Retell
- You can optionally specify area codes when purchasing
- Once purchased, phone numbers are yours indefinitely
The Python SDK provides the client.phone_number.create() method with parameters that you can specify for your phone number purchase [(2) ]() .AI Evy
08/04/2025, 2:50 AMAI Evy
08/04/2025, 2:50 AMadekurniawan44_59865
08/04/2025, 2:52 AMadekurniawan44_59865
08/04/2025, 2:53 AMAI Evy
08/04/2025, 2:53 AMAI Evy
08/04/2025, 2:53 AMpython
phone_number_response = client.phone_number.create(
inbound_agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", # Your agent ID for inbound calls
outbound_agent_id="oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD", # Your agent ID for outbound calls
area_code=415, # US area code (3 digit integer)
nickname="Frontdesk Number", # Optional nickname for reference
inbound_webhook_url="<https://example.com/inbound-webhook%22,> # Optional webhook URL
number_provider="twilio" # Optional: "twilio" or "telnyx" (defaults to twilio)
)
Required vs Optional Parameters:
- All parameters are optional
- area_code is a 3-digit integer for US area codes only
- inbound_agent_id - if null, the number won't accept inbound calls
- outbound_agent_id - if null, the number can't initiate outbound calls without agent override
- nickname is for your reference only
- inbound_webhook_url allows you to override agent settings per call
Simple example with just your agent:
python
phone_number_response = client.phone_number.create(
inbound_agent_id="agent_30992720c1b23f789b96942XXX", # Replace with your actual agent ID
outbound_agent_id="agent_30992720c1b23f789b96942XXX", # Replace with your actual agent ID
area_code=415 # Choose a US area code
)
print(phone_number_response)
Remember that phone numbers cost $2 per month and currently only US numbers are supported [(2) ]() .AI Evy
08/04/2025, 2:53 AMAI Evy
08/04/2025, 2:53 AMadekurniawan44_59865
08/04/2025, 2:54 AMAI Evy
08/04/2025, 2:54 AMAI Evy
08/04/2025, 2:55 AMpython
from retell import Retell
client = Retell(
api_key="YOUR_RETELL_API_KEY",
)
[(2) ]()
2. Check your API key format:
Make sure your API key is correct and properly formatted. The authentication header should contain your API key in the format "Bearer YOUR_API_KEY" [(1) ]() .
3. Verify your agent ID exists:
Before creating a phone number, ensure your agent ID is valid. You can test this by trying to retrieve the agent first using the Python SDK [(2) ]() .
4. Simple phone number creation:
Try creating a phone number without optional parameters first:
python
phone_number_response = client.phone_number.create()
[(1) ]()
5. With minimal parameters:
python
phone_number_response = client.phone_number.create(
area_code=415
)AI Evy
08/04/2025, 2:55 AMinbound_agent_id or outbound_agent_id parameters
- Incorrect API endpoint (though the Python SDK handles this automatically) [(2) ]()
The Create Phone Number API accepts optional parameters like inbound_agent_id, outbound_agent_id, area_code, nickname, inbound_webhook_url, and number_provider [(1) ]() . If any agent IDs you specify don't exist, you'll get a 404 error.
Try the minimal approach first, then gradually add parameters to identify which one is causing the issue.AI Evy
08/04/2025, 2:55 AMAI Evy
08/04/2025, 2:55 AMadekurniawan44_59865
08/04/2025, 2:58 AMAI Evy
08/04/2025, 2:58 AMAI Evy
08/04/2025, 2:59 AMjavascript
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) ;
Key troubleshooting steps:
1. Verify your API key format - Make sure your API key starts with the correct prefix and is complete
2. Check your account status - Ensure your Retell AI account has the necessary permissions to create phone numbers
3. Try with area code parameter - The Create Phone Number API accepts an area_code parameter as a 3-digit integer for US area codes :
python
phone_number_response = client.phone_number.create(
area_code=415
)
4. Verify the API endpoint - The Create Phone Number API uses the POST /create-phone-number endpoint
The Create Phone Number API documentation shows that all body parameters are optional, including inbound_agent_id, outbound_agent_id, area_code, nickname, inbound_webhook_url, and number_provider . However, a 404 error typically indicates an authentication or authorization issue rather than a parameter problem.
Note: Phone numbers purchased from Retell currently only support US area codes, and there may be account-level requirements for purchasing phone numbers .AI Evy
08/04/2025, 2:59 AMAI Evy
08/04/2025, 2:59 AMadekurniawan44_59865
08/04/2025, 3:07 AMAI Evy
08/04/2025, 3:07 AMAI Evy
08/04/2025, 3:07 AMAI Evy
08/04/2025, 3:07 AMAI Evy
08/04/2025, 3:07 AMadekurniawan44_59865
08/04/2025, 3:09 AMAI Evy
08/04/2025, 3:09 AMAI Evy
08/04/2025, 3:09 AMpython
from retell import Retell
client = Retell(
api_key="YOUR_RETELL_API_KEY",
)
chat_response = client.chat.create({
agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD'
})
print(chat_response.agent_id)
2. Using the Python SDK for Testing
The Python SDK provides convenient access to test your agent [(2) ]() :
python
from retell import Retell
client = Retell(
api_key="YOUR_RETELL_API_KEY",
)
agent_response = client.agent.create(
response_engine={
"llm_id": "llm_234sdertfsdsfsdf",
"type": "retell-llm",
},
voice_id="11labs-Adrian",
)
print(agent_response.agent_id)
3. Async Usage for Testing
You can also use async functionality for testing :
python
import asyncio
from retell import AsyncRetell
client = AsyncRetell(
api_key="YOUR_RETELL_API_KEY",
)
async def main() -> None:
agent_response = await client.agent.create(
response_engine={
"llm_id": "llm_234sdertfsdsfsdf",
"type": "retell-llm",
},
voice_id="11labs-Adrian",
)
print(agent_response.agent_id)
asyncio.run(main() )
Installation and Setup
First, install the Python SDK [(3) ]() :
bash
pip install retell-sdk
Then initialize your client :
python
from retell import Retell
client = Retell(
api_key="YOUR_API_KEY",
)AI Evy
08/04/2025, 3:09 AMretell.APIError for proper error handling [(2) ]()
- You can test conversation flows and agent responses programmatically
Testing Chat Sessions:
The Create Chat API allows you to test your agent through chat interactions, which is perfect for testing without phone numbers. You can create chat sessions with your agent and test the conversation flow programmatically [(1) ]() .
This approach lets you test your agent's functionality, response accuracy, and tool calling capabilities without needing to purchase a phone number first.AI Evy
08/04/2025, 3:09 AMAI Evy
08/04/2025, 3:09 AMadekurniawan44_59865
08/04/2025, 3:15 AMadekurniawan44_59865
08/04/2025, 3:16 AMAI Evy
08/04/2025, 3:16 AMAI Evy
08/04/2025, 3:17 AMpython
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) ;AI Evy
08/04/2025, 3:17 AMAI Evy
08/04/2025, 3:17 AMAI Evy
08/04/2025, 3:17 AMadekurniawan44_59865
08/04/2025, 3:21 AMadekurniawan44_59865
08/04/2025, 3:21 AMAI Evy
08/04/2025, 3:21 AMAI Evy
08/04/2025, 3:21 AMAI Evy
08/04/2025, 3:21 AMAI Evy
08/04/2025, 3:21 AMjavascript
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) ;
[(6) ]()
After purchasing, you can then apply for verification through the Retell AI dashboard to ensure your number maintains trusted status and isn't flagged as spam [(1) ]() .AI Evy
08/04/2025, 3:21 AMAI Evy
08/04/2025, 3:21 AMadekurniawan44_59865
08/04/2025, 3:22 AMadekurniawan44_59865
08/04/2025, 3:22 AMAI Evy
08/04/2025, 3:22 AMAI Evy
08/04/2025, 3:23 AMAI Evy
08/04/2025, 3:23 AMAI Evy
08/04/2025, 3:23 AM