When to use a custom function
Reach for a custom function whenever the agent needs live data from your systems, or has to take an action there, in the middle of a call:- Look up real-time data — order status, appointment slots, account details, shipment tracking.
- Take an action in your backend — create a support ticket, update a record, send a confirmation.
- Branch on your own logic — call an endpoint that decides where the flow goes next.
Example: order status lookup
A retail support agent needs to tell callers where their order is. You add aget_order_status custom function pointed at https://api.yourstore.com/orders. When a caller gives their order number, the agent calls the function with that number, your API returns the status and delivery date, and the flow branches to read it back or to escalate if the order can’t be found.
Create a custom function
When the function is called, Retell sends a request (POST, GET, PUT, PATCH, or DELETE) to your URL with the function name and arguments. You can add headers and query parameters, and extract values from the response.Name and describe it
get_order_status), and a clear description. The agent reads the description to decide when to call the function, so be specific about what it does and when to use it.
- Name:
get_user_details - Description:
Get user details based on name and age
Choose the HTTP method
Add the endpoint URL
Set a timeout (optional)
120000 (2 minutes). If your endpoint doesn’t respond in time, the request fails and the agent receives the error message (for example, a timeout error) to act on. Retell does not retry a custom function, so keep the endpoint fast and handle any retries on your side.Set request headers (optional)
{{token}}.
Set query parameters (optional)
Define parameters
description is filled in by the LLM, while a property with a const value is applied directly.Payload: args onlyWhen Payload: args only is on, the request body is just the function’s arguments at the top level, with no wrapper. When it’s off, the body follows the request spec below (name, call, and args).Example parameter schema:
Set response variables (optional)
user.name or data.items[0].id. This works only when your endpoint returns a JSON object.For example, from this response you could extract the user’s name and reference it later as {{user_name}}:
Troubleshooting
If the function won’t save, the parameters are usually invalid. The most common mistake is leaving"type": "object" off the top level of the JSON schema. Click one of the built-in examples and adjust from there.
Request and response spec
When the function is called, Retell sends a request to your endpoint with the following spec. Request- Headers
X-Retell-Signature: an HMAC-SHA256 signature of the request body, used to verify the request came from Retell. See Verify the request is from Retell below.Content-Type: application/json(for POST, PUT, and PATCH).
- Body (JSON, for POST, PUT, and PATCH only)
name: the name of the custom function.call: the call object, for context about the call. It includes the transcript up to the moment the request is sent. See Get Call for the full object.args: the function’s arguments, as a JSON object.
name, call, or args wrapper. Parse the parameters from the top level, and run signature verification against that same body string.Example request body
Example request body
Verify the request is from Retell
To confirm a request came from Retell, verify theX-Retell-Signature header against the raw request body using your Retell API key. For GET and DELETE requests the body is empty, so pass an empty string to the verify function.
100.20.5.228.FAQ
Why isn't my agent calling the function?
Why isn't my agent calling the function?
What information about the call can my endpoint access?
What information about the call can my endpoint access?
call object with details like the call ID, agent ID, metadata, dynamic variables, and the transcript up to the moment the function is called. Use it for context — for example, to look up the caller by their metadata or a dynamic variable.How do I send data back to the agent?
How do I send data back to the agent?
Does Retell retry a failed custom function?
Does Retell retry a failed custom function?
What happens if the user interrupts while a custom function is running?
What happens if the user interrupts while a custom function is running?
Why does signature verification fail?
Why does signature verification fail?
JSON.stringify(req.body) can reorder keys or change whitespace, which breaks the signature. Read the raw body (for example, with express.raw) and pass that exact string to the verify function.Can I point a custom function at localhost or a private IP?
Can I point a custom function at localhost or a private IP?
Is there a size limit on the response?
Is there a size limit on the response?

