AI Tools API
Let your AI chatbot call your own APIs, and manage those tools from code.
These endpoints use your API key and manage the same tools as the AI Tools page in the dashboard.
import { KerAbieClient } from '@kerabie/sdk';
const kerabie = new KerAbieClient({ apiKey: process.env.KERABIE_API_KEY });A tool is an API of yours that the chatbot may call mid-conversation: check stock, validate an address, look up an order, book a slot. The AI reads the tool's description to decide when to call it, collects the parameters from the customer, calls your endpoint, and uses the answer in its reply.
Three built-in tools are always available and need no setup: save_memory, get_memory and escalate_to_agent.
How a call works
| Method | What is sent |
|---|---|
GET | The parameters in the query string. |
POST, PUT, PATCH | The parameters as a JSON body. |
Your endpoint has 8 seconds to answer. If you set a responsePath such as data.message, only that part of a JSON reply is shown to the AI; otherwise it sees the whole reply (cut at 8,000 characters). A non-2xx answer, a timeout or a network error is reported to the AI as a failure, and it will say it couldn't complete the request.
Rules
- Public addresses only. Endpoints on
localhost, private networks or cloud metadata addresses are rejected, and redirects are not followed. Use the final URL. - Secrets are write-only.
authConfigvalues are stored when you send them and never returned. Onupdate, leave a secret out (or blank) to keep the stored one. - Plan limit. Your plan sets how many tools you can have.
stats.limitis-1when AI tools aren't on your plan and0when unlimited.createandduplicatereturn 403 when it is full. If you downgrade, the chatbot keeps using your oldest enabled tools up to the new limit. - Function names are snake_case and unique in your organisation (409 if taken).
- Up to 20 parameters and 10 custom headers per tool.
List tools
GET /v1/ai-toolsconst { tools, stats } = await kerabie.aiTools.list();{
"tools": [
{
"id": 1,
"name": "check_availability",
"displayName": "Check availability",
"description": "Use this when a customer asks if a specific item is in stock.",
"parameters": [
{ "name": "sku", "type": "string", "description": "Product SKU the customer mentioned", "required": true }
],
"endpoint": "https://api.yourstore.com/inventory/check",
"method": "GET",
"authType": "bearer",
"responsePath": "data.message",
"enabled": true,
"createdAt": "2026-10-01T09:00:00.000Z",
"updatedAt": "2026-10-01T09:00:00.000Z",
"usage": { "calls": 142, "failures": 6, "lastUsedAt": "2026-10-06T12:30:00.000Z" }
}
],
"stats": { "total": 1, "active": 1, "calls": 142, "successRate": 96, "limit": 5 }
}usage and stats.calls cover the last 30 days. successRate is null when there were no calls.
Get a tool
GET /v1/ai-tools/:idReturns the tool with authConfig (names only, secrets come back empty), headers and hasSecret.
Create a tool
POST /v1/ai-toolsconst { tool } = await kerabie.aiTools.create({
name: 'check_availability',
displayName: 'Check availability',
description: 'Use this when a customer asks if a specific item is in stock.',
endpoint: 'https://api.yourstore.com/inventory/check',
method: 'GET',
authType: 'bearer',
authConfig: { token: process.env.STORE_API_TOKEN },
responsePath: 'data.message',
parameters: [{ name: 'sku', type: 'string', description: 'Product SKU the customer mentioned' }],
});| Field | Description |
|---|---|
name | Required. snake_case, 2-60 characters. What the AI calls. |
displayName | Required. 2-80 characters. |
description | Required. 10-500 characters. Say when the AI should use the tool ("Use this when a customer asks…"). |
endpoint | Required. A public https:// (or http://) address. |
method | GET, POST (default), PUT or PATCH. |
parameters | List of { name, type, description?, required? }. type is string, number or boolean; required defaults to true. |
authType | none (default), bearer, api_key or basic. |
authConfig | bearer: { token } · api_key: { header, value } · basic: { username, password }. |
headers | Extra static headers sent on every call. |
responsePath | Dot-notation path into the JSON reply, e.g. data.message. |
enabled | Default true. |
Returns { "tool": { "id": 12 } }.
Update a tool
PATCH /v1/ai-tools/:idawait kerabie.aiTools.update(12, { enabled: false });Send only what you want to change. Changing authType needs the new secrets in authConfig.
Duplicate a tool
POST /v1/ai-tools/:id/duplicateCreates a copy named <name>_copy that starts switched off, so you can edit it before the AI can use it.
Delete a tool
DELETE /v1/ai-tools/:idTest a tool
POST /v1/ai-tools/:id/testconst result = await kerabie.aiTools.test(12, { sku: 'A-100' });
// { success: true, result: 'In stock: 14 units', statusCode: 200, durationMs: 184 }Calls your real endpoint once with args. It is not counted in usage, and is limited to 40 tests per hour per organisation (429).
Errors
| Status | When |
|---|---|
400 | Invalid input, or an endpoint on a private or local address. |
403 | AI tools aren't on your plan, or your plan's tool limit is reached. |
404 | No such tool in your organisation. |
409 | A tool with that function name already exists. |
429 | Test limit reached. |