# Custom API tools

URL: https://docs.assistantcore.com/en/tools-mcp/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 [#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](/en/tools-mcp/local-connector).

## Create a tool [#create-a-tool]

1. Open the [Admin Panel](https://admin.assistantcore.com) 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](#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](/en/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 [#fields]

| Field | Meaning |
| --- | --- |
| **Name** | Short, 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 |
| **Description** | The AI picks the tool from this text. Say what it does, when to use it, when not to, and what it returns |
| **Method** | `GET`, `POST`, `PUT`, `PATCH` or `DELETE` |
| **API URL** | The `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 |
| **Strict** | Makes the AI's arguments match the parameter types exactly |
| **JSON** | Shows the function definition the AI receives. You can edit it and apply it to update the parameters. Fixed parameters are not in it |

## Parameters [#parameters]

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

| Field | Meaning |
| --- | --- |
| **Parameter name** | Name sent to your API |
| **Type** | **Text**, **Integer**, **Number**, **True/false**, **One of** (a fixed list of values) or **List** |
| **Sent in** | **Query**, **JSON body**, **Path** or **Header**, see below |
| **Value** | **The AI fills it in** from the conversation, or **Fixed value**: the same value on every call, which the AI never sees |
| **Description for the AI** | What the value means, with an example, so the AI fills it correctly |
| **Required** | Whether the AI must provide it. Path values are always required |

| Sent in | How the value is sent |
| --- | --- |
| **Query** | `?name=value` on the URL. The default for `GET` and `DELETE` |
| **JSON body** | A field of the JSON body. The default for `POST`, `PUT` and `PATCH`. Not available for `GET` |
| **Path** | Replaces `{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 |
| **Header** | A 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.

<Callout type="warn">
A fixed value is stored as plain text. Put API keys and tokens under **Auth Type**, which encrypts them.
</Callout>

## Authentication [#authentication]

| Type | What to enter | Header sent |
| --- | --- | --- |
| **None** | Nothing | None |
| **Bearer Token** | The token | `Authorization: Bearer <token>` |
| **API Key** | The key, and a **Header Name** (default `X-API-Key`) | `<Header Name>: <key>` |
| **Basic Auth** | `user:password` | `Authorization: Basic <base64>` |
| **Custom Header** | A **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 [#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 [#response-and-limits]

| Field | Meaning |
| --- | --- |
| **Fields to keep** | Dot 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 reads** | Longer 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 [#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](/en/tools-mcp/approvals).

## Import from OpenAPI [#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 [#example]

| Field | Value |
| --- | --- |
| **Name** | `lookup_order` |
| **Description** | Looks 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 |
| **Method** | `GET` |
| **API URL** | `https://api.example.com/orders/{order_id}` |
| **Auth Type** | **Bearer Token** with your API token |
| Parameter | `order_id`, **Text**, sent in **Path**, filled in by the AI |
| Parameter | `lang`, **Text**, sent in **Query**, **Fixed value** `en` |
| **Fields to keep** | `status`, `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 [#troubleshooting]

| Problem | Check |
| --- | --- |
| "Tool name already exists for this assistant" | Choose another **Name** |
| The URL is rejected | Use 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 tool | Make 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 `403` | Check the authentication type, header name and credential. Run a test and look at the **Request** tab |
| The AI's answer is missing data | Check **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 app | It is a `DELETE` tool, or an approval rule sets it to Ask or Block |

<Cards>
<Card title="Tool approvals" description="Control which calls ask first." href="/en/tools-mcp/approvals" />

<Card title="MCP Server" description="Connect many tools at once from an MCP server." href="/en/tools-mcp/mcp-server" />
</Cards>