# API Reference

REST + WebSocket API for assistants, chats, knowledge, tools, phones, and webhooks

> Full REST + WebSocket API reference: https://api.happ.tools/reference

Happ exposes a REST + WebSocket API for managing assistants, sending messages, controlling AI mode, and integrating Happ into your workflows. The full, testable reference lives in Scalar — it is the source of truth for every endpoint, schema, and example.

**[api.happ.tools/reference](https://api.happ.tools/reference)**

## Resource groups [#resource-groups]

* **Assistants** — `GET/POST /api/assistants`, `PATCH /api/assistants/{id}`
* **Chats** — list/create chats, send and list messages, toggle AI control (`PATCH /api/chats/{id}` `isUnderAiControl`)
* **Knowledge Base** — `/api/assistant-knowledge`
* **Tools** — `/api/assistant-tools`
* **Phones** — `/api/phones`, link to an assistant

## Authentication [#authentication]

All requests require an **Access Token** generated in account settings at [my.happ.tools](https://my.happ.tools). Send it in the header:

```
X-Access-Token: happ_your_token_here
```

Base URL (production): `https://api.happ.tools`.

## WebSocket [#websocket]

Connect over Socket.IO at `wss://api.happ.tools/ws`: authenticate with your token, join your company room, then receive `MESSAGE_CREATED`, `CHAT_MODE_CHANGED`, and `CHAT_CREATED` events. See [Chats > Real-Time Updates](/docs/chats#real-time-updates).

## Use with AI [#use-with-ai]

Integrating with an AI assistant (Claude, Cursor, Copilot)? Hand it our machine-readable sources instead of copy-pasting docs:

* **OpenAPI spec** — `https://api.happ.tools/api/swagger-json` (every endpoint, schema, and auth rule)
* **Docs index** — `https://docs.happ.tools/llms.txt`

Starter prompt:

```text
You are integrating with the Happ Platform API.
Spec: https://api.happ.tools/api/swagger-json
Docs: https://docs.happ.tools/llms.txt
Auth: send the header X-Access-Token: happ_...
Task: <describe what you want to build>
```

## Next [#next]

* [Chats](/docs/chats) — the inbox these endpoints drive
* [Webhooks](/docs/integrations/webhooks) — push events to your server
