---
title: "Chat API"
description: "Build your own chat UI on top of the chat API."
canonical_url: "https://aiduko.com/docs/chatbots/api"
---

> Index of every page on this site: [llms.txt](https://aiduko.com/llms.txt)

The chat API lets your own app ask your chatbot questions. Your server calls the API with a secret key and streams the answer, including its sources, to your frontend.

Aiduko doesn't ship a ready-made chat widget. You build the chat UI yourself, usually with a coding agent (see [below](#let-a-coding-agent-build-your-chat-ui)). The chat then lives inside your app: it uses your components and styles, and there is no external script to load or third-party widget to restyle.

## Create an API key

Open the chatbot's **API** tab and select **New API key**. Each key has:

- a **name**, for example the app or environment that uses it
- a **monthly token budget** for questions and answers together
- a **rate limit** in requests per minute

The key is shown only once. Store it in your server's environment, for example as `NUXT_CHATBOT_API_KEY`. **Never put it in frontend code**: anyone who has the key can use your budget.

The API tab shows each key's usage for the current month. Revoking a key stops every app that uses it immediately.

## Call the API

Send a `POST` request to `/api/v1/chat` with the header `Authorization: Bearer <key>`. The request body is the conversation in the format of the [AI SDK](https://ai-sdk.dev) (`useChat` or `Chat`), so a chat UI built with it works without conversion:

```json
{
  "id": "chat-123",
  "messages": [
    { "id": "1", "role": "user", "parts": [{ "type": "text", "text": "What does the Pro plan cost?" }] }
  ]
}
```

The `id` groups the questions of one conversation in **Chats**. The answer is streamed as an AI SDK UI message stream. Citations like `[2]` in the text refer to the `source-url` part with the same `sourceId`.

The full reference with all limits and error codes is available as [llms.txt](https://aiduko.com/api/v1/llms.txt) and as an [OpenAPI specification](https://aiduko.com/api/v1/openapi.json).

## Let a coding agent build your chat UI

On the API tab, select **Copy integration prompt** and paste it into a coding agent like Claude Code or Cursor in your Nuxt project. The prompt describes a server route that keeps the key secret and limits requests per visitor, plus a chat component that shows the sources.

The agent builds that component from your existing code, so the chat matches your design from the start. Ask it for changes like any other feature: a floating button, a full help page, a chat in the sidebar, your own colors and wording.

## Use the chatbot in AI tools

The same API keys also work for the chatbot's [MCP server](https://aiduko.com/docs/chatbots/mcp). Tools like Claude Code and Cursor connect to it directly, without your own server route.

## When requests are rejected

- **401:** the key is missing, unknown or revoked.
- **429 rate_limited:** too many requests per minute. Wait for the time in the `Retry-After` header.
- **429 budget_exceeded:** the key's monthly budget is used up. Wait for the next month, or create a new key with a higher budget and revoke the old one.
- **429 plan_limit_reached:** your team's monthly tokens are used up. See [Plans and usage](https://aiduko.com/docs/workspace/plans-and-usage).

## Optional source display

In the chatbot behavior settings, owners and admins can turn off **Show answer sources**.
Existing chatbots show sources by default. With source display off, visitor answers
omit citation markers and source links, and the public stream omits `source-url`
parts. Message metadata contains `sourcesVisible: false`; integrations must not
interpret missing source parts as a retrieval failure in this mode. Hidden-source
text is emitted in complete lines to safely handle citation markers split across
tokens. The public request cannot override the saved setting.

Answers still use the connected knowledge. Source evidence remains in authorized
history and debug views for review and corrections. This setting controls display;
it does not make the underlying public website content confidential.

## Sitemap

See the full [sitemap](https://aiduko.com/sitemap.md) for all pages.
