set_pre_call_api
Configure or disable an automatic API call that runs before each call to enrich the agent with data, extracting response values into variables usable in prompts.
Instructions
Configure (or disable) an agent's pre-call API. This is an HTTP request the platform makes automatically BEFORE the call connects — typically to enrich the agent with data, e.g. look up a customer record by phone number. Values extracted via response_variables become {{variables}} you can reference in the prompt and first message. This is different from add_agent_tool: a pre-call API always runs once before the call and is not chosen by the LLM, whereas an api_call tool is invoked by the agent during the conversation. There is exactly one pre-call API per agent (this replaces it). For versioned agents the change is saved as a draft — pass draft_id to stack onto an existing draft, then publish_draft to make it live.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Endpoint URL. Required when enabling. May contain {{variable}} placeholders (e.g. system variables like {{from_number}}). | |
| body | No | Request body as a JSON object (for POST/PUT/PATCH). Values may contain {{variable}} placeholders. | |
| method | No | HTTP method. Default GET. | |
| enabled | No | Enable the pre-call API (default true). Pass false to disable it while keeping the saved config. | |
| headers | No | Request headers as key/value pairs. Values may contain {{variable}} placeholders. | |
| agent_id | Yes | The agent ID to configure | |
| draft_id | No | Existing draft to write into (stacks this change onto the draft's other edits). Omit to create a new draft from the live version. | |
| query_params | No | URL query parameters as key/value pairs. Values may contain {{variable}} placeholders. | |
| timeout_secs | No | Request timeout in seconds (1-30). Default 5. Note: seconds, not milliseconds. | |
| response_variables | No | Extract values from the API response into variables usable in the prompt and first message. |