Skip to Content
Assistant Core

Custom API tools

Create a tool that calls your own HTTPS API, such as an order lookup or ticket creation, test it before you save, and control what the AI reads back.

A custom API tool lets the assistant call an HTTP API you own when a request needs it, for example to check an order, look up an appointment or create a support ticket. The assistant fills in the parameters from the conversation.

Prerequisites

  • The Assistant Owner role on the assistant.
  • An API reachable at a public https:// URL. Private, local and cloud metadata addresses are blocked. For a service on your own network, use a local connector.

Create a tool

  1. Open the Admin Panel and select the assistant.
  2. Go to Tools and click New API tool. If your API has an OpenAPI or Swagger document, click Import from OpenAPI instead, see Import from OpenAPI.
  3. Under Basics, fill in Name and Description.
  4. Under Request, choose the Method, enter the API URL and, if your API needs it, the Auth Type.
  5. Under Parameters, click Add parameter for each value the request sends.
  6. In the Test panel, enter sample values and click Run test to see the real response.
  7. Click Create tool, or press Ctrl+S (⌘+S on a Mac).

The tool appears under Custom API on the Tools page and is available from the next message. To see it in a real conversation, open the conversation in Tracing.

The editor keeps your work: following a link or closing the tab with unsaved changes asks first, and the footer always shows whether there is anything to save.

Fields

FieldMeaning
NameShort, action-style name, for example lookup_order. 1–64 letters, digits, underscores or hyphens, starting with a letter or underscore. Must be unique on the assistant
DescriptionThe AI picks the tool from this text. Say what it does, when to use it, when not to, and what it returns
MethodGET, POST, PUT, PATCH or DELETE
API URLThe https:// endpoint to call. Put path values in braces, such as /orders/{order_id}. Don't put credentials in the URL; use Auth Type instead
StrictMakes the AI's arguments match the parameter types exactly
JSONShows the function definition the AI receives. You can edit it and apply it to update the parameters. Fixed parameters are not in it

Parameters

Each parameter is a value the request sends. For each one, choose where it goes and who supplies it.

FieldMeaning
Parameter nameName sent to your API
TypeText, Integer, Number, True/false, One of (a fixed list of values) or List
Sent inQuery, JSON body, Path or Header, see below
ValueThe AI fills it in from the conversation, or Fixed value: the same value on every call, which the AI never sees
Description for the AIWhat the value means, with an example, so the AI fills it correctly
RequiredWhether the AI must provide it. Path values are always required
Sent inHow the value is sent
Query?name=value on the URL. The default for GET and DELETE
JSON bodyA field of the JSON body. The default for POST, PUT and PATCH. Not available for GET
PathReplaces {name} in the API URL. The URL must contain the matching placeholder, and the value is encoded so it cannot change the host or add a path segment
HeaderA request header. Authorization, Cookie, Host, Content-Type and similar headers are reserved

The Request preview under the parameters shows the method, URL, headers and body fields the request will use.

A fixed value is stored as plain text. Put API keys and tokens under Auth Type, which encrypts them.

Authentication

TypeWhat to enterHeader sent
NoneNothingNone
Bearer TokenThe tokenAuthorization: Bearer <token>
API KeyThe key, and a Header Name (default X-API-Key)<Header Name>: <key>
Basic Authuser:passwordAuthorization: Basic <base64>
Custom HeaderA Header Name and its value<Header Name>: <value>

The credential is encrypted before it is stored, and the form only shows Credential saved (encrypted) afterwards. When you edit the tool, leave the credential empty to keep it, or type a new one to replace it. A saved credential only goes to the address it was saved for: if you change the API URL to a different host, enter the credential again. If your API needs OAuth or mutual TLS, put a small proxy in front of it.

Test before you save

The Test panel calls your API once with the values you enter, exactly as a conversation would, and saves nothing. It shows:

  • What the AI sees: the text the AI reads back, after Fields to keep and the character limit are applied.
  • Response: the status, duration and full response body.
  • Request: the method, URL, headers and body that were sent. Credentials are masked.

A test of a POST, PUT, PATCH or DELETE tool really runs on your API, so the panel asks you to confirm first. Tests count toward a per-user rate limit.

Response and limits

FieldMeaning
Fields to keepDot paths into a JSON response, such as data.items.name. A list keeps the field for each item. Empty keeps everything
Most characters the AI readsLonger responses are cut off at this length. 1,000–100,000, default 20,000
Timeout (seconds)How long to wait for an answer. 1–120, default 30

Keeping only the fields the AI needs makes answers cheaper and faster, and keeps data the AI shouldn't see out of the conversation.

How the call is made

  • Responses over 1 MB are rejected.
  • Up to 3 redirects are followed. Credentials are not sent to a different host.
  • An error status (4xx or 5xx) is reported to the assistant as a failed call, with the status code and the start of the response body, so it can correct the request or tell the user.

The method also decides whether a call waits for approval: GET runs on its own, POST, PUT and PATCH ask first in the Web App, and DELETE asks every time and is not offered on the widget, API, voice or messaging. The Tools page marks these tools Asks first. See Tool approvals.

Import from OpenAPI

  1. On a new tool, click Import from OpenAPI.
  2. Enter the document's URL under From URL, or paste its JSON or YAML under Paste, and click Read document.
  3. Pick an operation. Filter the list if the document is long.

The editor fills in the name, description, method, URL, parameters with their locations, and the auth type from the document. Parts it cannot import are listed above the form. Nothing is saved until you click Create tool, and you enter the credential yourself. Documents up to 2 MB are supported.

Example

FieldValue
Namelookup_order
DescriptionLooks up an order's status and delivery date by order number. Use it when the customer asks where their order is. Do not use it for returns
MethodGET
API URLhttps://api.example.com/orders/{order_id}
Auth TypeBearer Token with your API token
Parameterorder_id, Text, sent in Path, filled in by the AI
Parameterlang, Text, sent in Query, Fixed value en
Fields to keepstatus, delivery_date

When a user asks "Where is order A123?", the assistant calls GET https://api.example.com/orders/A123?lang=en with the bearer token, reads only the status and delivery date, and summarizes them.

Troubleshooting

ProblemCheck
"Tool name already exists for this assistant"Choose another Name
The URL is rejectedUse a public https:// URL without a username, password, # fragment or credentials in the query. Braces are only allowed in the path
"The address moved to another site. Enter the credential again…"You changed the API URL to a different host. Type the credential under Auth Type
The assistant never calls the toolMake the Description say when to use it, or mention the tool in the system prompt. Check that it is on, and allowed where you test it (Available in)
The call fails with HTTP 401 or 403Check the authentication type, header name and credential. Run a test and look at the Request tab
The AI's answer is missing dataCheck Fields to keep and Most characters the AI reads in the test's What the AI sees tab
The call is refused on the widget or a messaging appIt is a DELETE tool, or an approval rule sets it to Ask or Block

Last updated on