PixelDrift42
09/02/2025, 5:55 PMAI Evy
09/02/2025, 5:55 PMAI Evy
09/02/2025, 5:56 PMmetadata parameter [(1) ]() [(2) ]() [(3) ]() . Here are examples from the Retell AI JavaScript SDK:
For updating an existing call:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponse = await client.call.update('call_a4441234567890777c4a4a123e6', {
data_storage_setting: 'everything_except_pii',
metadata: { customer_id: 'cust_123', notes: 'Follow-up required' },
}) ;
console.log(callResponse) ;
[(1) ]()
For registering a phone call:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
[(2) ]()
For creating a web call:
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) ;
[(3) ]()
The metadata is described as "an arbitrary object for storage purpose only" that you can use to store information like internal customer IDs associated with the call [(1) ]() [(2) ]() [(3) ]() . It's not used for processing but can be retrieved later from the call object .AI Evy
09/02/2025, 5:56 PMAI Evy
09/02/2025, 5:56 PMAI Evy
09/02/2025, 6:14 PMPixelDrift42
09/02/2025, 6:17 PMAI Evy
09/02/2025, 6:17 PMAI Evy
09/02/2025, 6:17 PMAI Evy
09/02/2025, 6:17 PMpython
from retell import Retell
client = Retell()
agent_response = client.agent.create(
response_engine={
"llm_id": "llm_234sdertfsdsfsdf",
"type": "retell-llm",
},
voice_id="11labs-Adrian",
user_dtmf_options={},
)
print(agent_response.user_dtmf_options)
[(1) ]()
For updating a call:
python
from retell.types import CallResponse, PhoneCallResponse, WebCallResponse, CallListResponse
[(2) ]()
The Python SDK provides methods like client.call.create_phone_call(), client.call.create_web_call(), and client.call.update() that accept metadata parameters . You can pass metadata as a dictionary containing arbitrary key-value pairs for storage purposes .
Error handling example:
python
import retell
from retell import Retell
client = Retell()
try:
client.agent.create(
response_engine={
"llm_id": "llm_234sdertfsdsfsdf",
"type": "retell-llm",
},
voice_id="11labs-Adrian",
)
except retell.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except retell.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except retell.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)AI Evy
09/02/2025, 6:17 PMPixelDrift42
09/02/2025, 6:18 PMAI Evy
09/02/2025, 6:18 PMAI Evy
09/02/2025, 6:18 PMmetadata parameter is available in the Retell AI API calls [(1) ]() [(2) ]() [(3) ]() [(4) ]() [(5) ]() .
Here's the JavaScript SDK example showing the metadata argument:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponse = await client.call.update('call_a4441234567890777c4a4a123e6', {
data_storage_setting: 'everything_except_pii',
metadata: { customer_id: 'cust_123', notes: 'Follow-up required' },
}) ;
console.log(callResponse) ;
[(1) ]()
For phone calls, you can also include metadata when creating the call:
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) ;AI Evy
09/02/2025, 6:18 PMAI Evy
09/02/2025, 6:18 PMAI Evy
09/02/2025, 6:18 PM