> ## Documentation Index
> Fetch the complete documentation index at: https://help.treble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Call Tool

> How to configure and use the API calling tool

The API call tool allows the agent to make API calls to external services during execution. Use it when you need to send information or perform actions in your system.

<img src="https://mintcdn.com/trebleai/89966LUoma77gDWQ/images/tom-api-tool-config.png?fit=max&auto=format&n=89966LUoma77gDWQ&q=85&s=1cd8e480d722d222111b83919b99a6c5" alt="API call tool configuration" width="940" height="1446" data-path="images/tom-api-tool-config.png" />

<img src="https://mintcdn.com/trebleai/89966LUoma77gDWQ/images/tom-api-tool-preview.png?fit=max&auto=format&n=89966LUoma77gDWQ&q=85&s=c02d44e72fdd92e0686c2fcaf5182bb8" alt="API call tool preview" width="3456" height="1748" data-path="images/tom-api-tool-preview.png" />

* **Configure the URL** with the full https protocol.
* **Define the body** that the agent should send if needed. The body must include all the relevant information so the service can respond without additional steps.
* **Limit the response time**: the service must reply in less than 10 seconds or the call will be considered failed.
* **Unprocessed outputs**: the agent does not transform the external service response. The endpoint must return a JSON response.

## Using variables in the API call

The API call tool lets you use variables within the agent context in the **headers**, **URL parameters**, or the **body** of the request. This is useful to personalize each call with data relevant to the user or the conversation.

### How to reference variables

Insert variables using double braces, for example: `{{variable_name}}`.

<img src="https://mintcdn.com/trebleai/89966LUoma77gDWQ/images/tom-api-tool-variable-config.png?fit=max&auto=format&n=89966LUoma77gDWQ&q=85&s=f2ef6876e18302ce186514ca97fa703c" alt="Variable configuration in the API call tool" width="914" height="1438" data-path="images/tom-api-tool-variable-config.png" />

### Best practices

* **Verify that variables exist before using them:** Make sure the agent has gathered the necessary information before sending the call.
* **Use descriptive names:** Keep a standard for variable names to avoid confusion or replacement errors.

<img src="https://mintcdn.com/trebleai/89966LUoma77gDWQ/images/tom-api-tool-variables-example.png?fit=max&auto=format&n=89966LUoma77gDWQ&q=85&s=ec0c461a047820d69b9e686e03739a97" alt="Example of the API call tool with the save variable tool" width="3456" height="1748" data-path="images/tom-api-tool-variables-example.png" />

Before enabling the tool in production, test the flow with real data to confirm timings, formats, and error handling.
