Operations
Operations

Set pre-call functions

Set the agent's pre-call functions: some of its own tools, run before the conversation starts so the agent begins already holding the caller's record (a CRM or directory lookup, their open tickets) instead of opening with 'let me pull up your details'. This is Retell's pre-call functions slot. Each function names a tool, the arguments to send (literal text, a {{caller.*}} field such as {{caller.number}} on a phone call or {{caller.email}} from a Teams sign-in, or a {{variable}} an earlier function maps) and, optionally, response fields to keep as variables for later functions (e.g. {"caller_sys_id": "result.0.sys_id"}). They all start together; one that uses another's variable runs after it, and is skipped when that variable came back empty. Every call that returned a result reaches the agent in its call context, before the caller's first words, on every phone call, Teams call, chat and eval. The tools run as they do when the model calls them (same URL, headers, secrets and mocks). This list is read only while the version's workflow has no pre-call functions; prefer set_workflow_function. Pass the whole list; [] removes them. Use when the operator says 'look the caller up before the call', 'the agent should already know who's calling', 'stop it saying let me pull up your details', or asks for Retell-style pre-call functions, dynamic variables or an inbound call webhook.

POST
/operations/set_pre_call_functions

Authorization

bearerAuth
AuthorizationBearer <token>

A personal access token from Settings > API tokens.

In: header

Header Parameters

Idempotency-Key?string

A key you choose, such as a UUID, that makes this POST safe to retry. Within 24 hours the same key and request answers with the first successful answer and runs nothing, the same key with a different request answers 422 idempotency_key_reused, and a key whose request is still running answers 409 idempotency_key_in_use. A failed request keeps nothing, so the same key runs it again.

Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/operations/set_pre_call_functions" \  -H "Content-Type: application/json" \  -d '{    "functions": [      {        "tool": "string",        "args": {          "property1": "string",          "property2": "string"        }      }    ],    "agent": "string"  }'
{}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "errors": [
    {
      "path": "string",
      "message": "string"
    }
  ],
  "estimate": {},
  "retryAfterSeconds": 0
}