> For the complete documentation index, see [llms.txt](https://learn.doubletick.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-custom-tools-for-your-ai-agent/create-an-api-tool-for-your-ai-agent.md).

# Create an API tool for your AI agent

Learn how to create an API tool that lets your AI agent fetch live data from your systems and send details back to them, such as checking an order status or creating a lead.

Customers often ask things only your own systems can answer: "Where is my order?", "Is this property still available?", "What slots are free on Saturday?"

An API tool lets your AI agent look up the answer in real time. The agent collects the details it needs from the customer, calls your system, and uses the result to reply. It can also send details the other way, for example to create a new lead in your CRM.

#### What's covered

* [When should you use an API tool?](#when-should-you-use-an-api-tool)
* [How does an API tool work?](#how-does-an-api-tool-work)
* [Before you begin](#before-you-begin)
* [How to create an API tool](#how-to-create-an-api-tool)
* [How to test your API tool](#how-to-test-your-api-tool)
* [How to fix common problems](#how-to-fix-common-problems)

<figure><img src="https://2303112206-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F53n17VnOICC1LtDqlENV%2Fuploads%2FvsT9hfxttRmFB1F1kMYX%2F06%20-%20Create%20your%20own%20API%20tool.gif?alt=media&amp;token=3dce833c-8a8f-4ff9-8d2f-fb6a8eeb62b1" alt=""><figcaption></figcaption></figure>

#### When should you use an API tool?

Use an API tool when the answer depends on live data from another system, or when the agent needs to send data to one.

| When the customer...                          | The API tool can...                            |
| --------------------------------------------- | ---------------------------------------------- |
| Asks "Where is my order?"                     | Fetch the order details using the order ID     |
| Shares their phone number                     | Look up their record in your CRM               |
| Asks which properties are available in a city | Fetch a list of properties for that city       |
| Wants to book a site visit                    | Send the booking to your scheduling system     |
| Says "Register me as a lead"                  | Create a new lead in your CRM                  |
| Asks which time slots are free                | Fetch available slots from your booking system |

If you want the agent to do something inside DoubleTick instead, such as assigning a chat or adding a tag, use a [Create a Bot tool for your AI agent](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-custom-tools-for-your-ai-agent/create-a-bot-tool-for-your-ai-agent.md).

#### How does an API tool work?

* The customer sends a message.
* The agent checks your tool descriptions and selects the API tool that matches the request.
* If the tool requires parameters, the agent asks the customer for the necessary details.
* Once all the details are available, the agent sends a request to your API.
* Your system returns a response.
* The agent uses the response to answer the customer.

This entire process happens in the background, so the customer can simply chat with the agent.

#### Before you begin

Have these ready. Your developer can share most of them with you.

* The **URL** of the API you want to call.
* The **method** it uses, such as GET or POST.
* Any **headers** it needs, such as an API key.
* The **request body**, if the API expects one, and the names of the fields in it.

If your developer has a **cURL command** for the API, ask for it. You can paste it into DoubleTick and most of the form fills itself in.

<figure><img src="https://2303112206-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F53n17VnOICC1LtDqlENV%2Fuploads%2FhFP40HJl1xVeHzuK6U0O%2FUntitled%20design%20-%202026-10-28T064447.134.gif?alt=media&amp;token=257e12d4-626a-43b3-8318-4112aa6a6cc2" alt=""><figcaption></figcaption></figure>

#### How to create an API tool

<figure><img src="https://2303112206-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F53n17VnOICC1LtDqlENV%2Fuploads%2F752EBZhKxV2IbTxlvxnj%2Fimage.png?alt=media&amp;token=dd5a664d-dfd6-435e-b972-0e2d1cffce45" alt="" width="489"><figcaption></figcaption></figure>

**Step 1: Name the tool and describe it**

* Open your agent and click **Tools** in the left menu.
* Click **Add tool**. The **Create Tool** panel opens.
* In **Name**, type a short name using lowercase words joined by underscores, for example `get_order_status` or `book_site_visit`.
* In **Description**, tell the agent when to use this tool. The agent reads this to decide when to call the API, so be specific. For example: "Use this when the customer asks about the status of their order. Ask for the order ID first."
* Under **Type**, select **API**.
* Under **Available for**, choose where the agent can use this tool: **All**, **Voice only** or **Text only**.

<figure><img src="https://2303112206-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F53n17VnOICC1LtDqlENV%2Fuploads%2FBPBdA3sCajIzZAMQEqLX%2Fimage.png?alt=media&amp;token=e8947703-70fb-4538-ae12-da1815d81f49" alt=""><figcaption></figcaption></figure>

**Step 2: Add parameters**\
Parameters are the details the agent collects from the customer before it calls your API. Click **Add parameter** for each one and fill in:

* **Name:** Use exactly the same name as the field in your API request. For example, `order_id`.
* **Type:** Choose **Text**, **Number**, **Options**, **Yes / No**, **List of text** or **JSON object**. Most tools only need **Text** and **Number**. Choose **Options** if the customer must pick from a fixed list, and type the choices separated by commas.
* **Description:** Explain what the detail is and how it should look. This helps the agent ask for it properly. For example: "Visit date in YYYY-MM-DD format" or "The 6 digit order ID shared by the customer". You can use up to 255 characters.
* **Sample value:** A realistic example, such as `351939` or `2026-06-15`. The test in the next step uses it in place of the customer's answer, so make sure it matches the type.
* **Required parameter:** Tick this if the API can't work without this detail.

<figure><img src="https://2303112206-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F53n17VnOICC1LtDqlENV%2Fuploads%2FD6x4lFN7ZsaldaAanEnb%2Fimage.png?alt=media&amp;token=6c6f3b20-ebc1-42c7-b108-6eecbf67e70c" alt=""><figcaption></figcaption></figure>

**Step 3: Import from cURL (optional, but a big time saver)**\
If you have a cURL command, click **Import from cURL** and paste it. DoubleTick fills in the **Method**, the **URL**, the **Headers** and a starting version of the **Request Body** for you.

If you don't have a cURL command, you can fill in the details yourself.

* Choose the **Method**: **GET**, **POST**, **PUT**, **PATCH** or **DELETE**.
* Enter the **URL**.
* Click **Add header** for each header your API needs, and type the name and the value. For example, a header named `x-api-key` with your key as the value. Click the cross next to a header to remove it.

**Step 4: Add the parameters to the request body**\
In **Request Body**, write the data your API expects, and use `{{parameter_name}}` wherever a value from the customer should go. For example:

```
{
  "customer_id": {{customer_id}},
  "property_id": {{property_id}},
  "visit_date": "{{visit_date}}",
  "visit_time": "{{visit_time}}"
}
```

A few things to get right:

* The name inside `{{ }}` must match the parameter's name exactly. If it doesn't, the call fails.
* Put text values in quotes, like `"{{visit_date}}"`. Leave numbers without quotes, like `{{customer_id}}`.
* Click **Prettify JSON** to tidy up the formatting and spot mistakes.

{% hint style="info" %}
For a simple GET request, you may not need a request body at all. Many GET APIs take their details in the URL instead.
{% endhint %}

#### How to test your API tool

Always test before you save. It's much easier to fix a problem now than after customers have used the tool.

* Click **Test API** at the bottom of the panel.
* DoubleTick calls your API using your **sample values** in place of the parameters.
* Read the response. Does it return what you expected?
* If the test passes, click **Create** to save the tool.

After saving, check that the toggle next to the tool is on. The agent won't use a tool that is switched off. When customers chat with your agent, the sample values are replaced by what they actually say.

{% hint style="warning" %}
Don't save the tool until **Test API** works. A tool that fails the test will fail for your customers too.
{% endhint %}

#### How to fix common problems

If **Test API** fails, check these first:

<table><thead><tr><th width="287.4444580078125">Problem</th><th>What to check</th></tr></thead><tbody><tr><td>The API says you aren't allowed</td><td>The API key or other value in <strong>Headers</strong> is wrong or missing</td></tr><tr><td>The API says the request is invalid</td><td>A parameter name in <code>{{ }}</code> doesn't match the parameter's name</td></tr><tr><td>The API rejects a value</td><td>The sample value has the wrong type, or text is missing quotes in the request body</td></tr><tr><td>Nothing comes back</td><td>The <strong>URL</strong> or <strong>Method</strong> is wrong</td></tr></tbody></table>

If the test passes but the agent still doesn't use the tool, check that the toggle is on, that the description clearly says when to use the tool, and that **Available for** includes the channel you are testing on.

#### Key takeaways

* An API tool lets your agent fetch live data from your systems or send data to them.
* Import a cURL command to fill in the method, URL, headers and body in one go.
* Parameter names must match the request body exactly.
* Give every parameter a clear description and a sample value.
* Click **Test API** and fix any problems before you click **Create**.
* Keep the tool's toggle on, or the agent won't use it.

#### FAQs

<details>

<summary>What is the difference between an API tool and a Bot tool?</summary>

An API tool calls another system directly and gives the answer back to the agent. A Bot tool starts a journey in Bot Builder. Use an API tool to fetch or send data elsewhere, and a Bot tool to take an action in DoubleTick.

</details>

<details>

<summary>Do I need a developer to create an API tool?</summary>

You need the details of the API, such as the URL, the method and the headers. A developer usually shares these, often as a cURL command that you can paste in.

</details>

<details>

<summary>Which methods can I use?</summary>

GET, POST, PUT, PATCH and DELETE.

</details>

<details>

<summary>Where do I keep my API key?</summary>

Add it as a header, for example `x-api-key`, using **Add header**.

</details>

<details>

<summary>What is the sample value for?</summary>

It is only used for testing. When **Test API** runs, it uses your sample values in place of the customer's answers. In real conversations, the agent uses what the customer says.

</details>

<details>

<summary>Can I use an API tool on calls?</summary>

Yes. Under **Available for**, choose **All** or **Voice only**. You can also select **Pre-call tool** to fetch customer details before a call starts. See [Create an AI agent for WhatsApp and PSTN calls](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-an-ai-agent-for-whatsapp-and-pstn-calls.md) for how to use the reply.

</details>

#### Related articles

{% content-ref url="/spaces/53n17VnOICC1LtDqlENV/pages/DR4vJxhjrqrOxOcGQPqx" %}
[Create a Bot tool for your AI agent](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-custom-tools-for-your-ai-agent/create-a-bot-tool-for-your-ai-agent.md)
{% endcontent-ref %}

{% content-ref url="/spaces/53n17VnOICC1LtDqlENV/pages/V2sD3IwTrLcIuHfMrnL6" %}
[Create an AI agent for WhatsApp & Instagram chats](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-an-ai-agent-for-whatsapp-and-instagram-chats.md)
{% endcontent-ref %}

{% content-ref url="/spaces/53n17VnOICC1LtDqlENV/pages/h5uPh6F6mnMCELsvysQD" %}
[Create an AI agent for WhatsApp and PSTN calls](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-an-ai-agent-for-whatsapp-and-pstn-calls.md)
{% endcontent-ref %}

{% content-ref url="/spaces/53n17VnOICC1LtDqlENV/pages/sXF9tbyEAUEiyaCHCC5a" %}
[Introduction to AI agents](https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/introduction-to-ai-agents.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://learn.doubletick.io/doubletick-ai/ai-agents-and-assistance/create-custom-tools-for-your-ai-agent/create-an-api-tool-for-your-ai-agent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
