Docs / Developers / API reference

API reference

CloudyBot exposes a REST API for dashboard-style integrations: sign up or log in, create threads, send chat, and read usage. The canonical interactive spec is /api-docs (OpenAPI 3.1 + Swagger UI). This page explains how the pieces fit together; request/response schemas live in the spec.

Open interactive API reference

Base URL and format

Authentication

User routes require Authorization: Bearer <session token>. Obtain a token from POST /api/auth/signup or POST /api/auth/login. The API derives userId from the session only — a mismatched userId in POST /chat returns 400.

There is no separate public API-key product today; integrations reuse the same session model as the web dashboard. Admin-only diagnostics use X-Admin-Token and are not for end-user apps.

Core endpoints (integrator path)

Typical sequence:

  1. POST /api/auth/login → session token.
  2. POST /api/threadsthreadId (optional title).
  3. POST /chat with message and threadId (optional attachmentFileIds, model, fastMode).
  4. GET /api/chat/history?threadId=… for transcript replay; GET /usage/me for remaining AI credits.

Thread CRUD: GET /api/threads, PATCH /api/threads/:id, DELETE /api/threads/:id. Pinned facts per thread: GET/PUT/DELETE /api/user/memory?threadId=… — see memory model.

What the spec documents

Browser sessions (/api/browser/*), integration status routes, and skill-specific connectors are documented in repo docs/API-REFERENCE.md and feature READMEs; some are omitted from the public OpenAPI surface.

Errors and limits

Common chat failures:

Plan caps (AI credits, browser minutes, retention) come from plans.jslimits FAQ. Successful chat responses include usage.remaining / remainingTasks task-equivalent credits.

Architecture context

POST /chat hits the CloudyBot API first; an optional OpenClaw gateway runs the agent loop and tools. Memory is scoped per threadId, not globally per user. Flow diagram and data stores: architecture overview.

Related: /api-docs (canonical spec) · Developers hub · repo docs/API-REFERENCE.md · First task guide