Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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?

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.

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.

How to create an API tool

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.

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.

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:

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.

For a simple GET request, you may not need a request body at all. Many GET APIs take their details in the URL instead.

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.

How to fix common problems

If Test API fails, check these first:

Problem
What to check

The API says you aren't allowed

The API key or other value in Headers is wrong or missing

The API says the request is invalid

A parameter name in {{ }} doesn't match the parameter's name

The API rejects a value

The sample value has the wrong type, or text is missing quotes in the request body

Nothing comes back

The URL or Method is wrong

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

What is the difference between an API tool and a Bot tool?

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.

Do I need a developer to create an API tool?

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.

Which methods can I use?

GET, POST, PUT, PATCH and DELETE.

Where do I keep my API key?

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

What is the sample value for?

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.

Can I use an API tool on calls?

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 for how to use the reply.

Create a Bot tool for your AI agentCreate an AI agent for WhatsApp chatsCreate an AI agent for WhatsApp and PSTN callsIntroduction to AI agents

Last updated