Reference

API Overview

API Overview

packages/protocol/openapi.yaml is the API contract source of truth. Server handlers live in apps/api/internal/httpapi; the TypeScript SDK in packages/sdk-ts is the typed client.

#Auth

The server resolves callers in this order (see ../features/auth.md):

  1. Authorization: Bearer <token> (session token, magic-link result).
  2. cc_session cookie.
  3. X-ClickClack-User: usr_... header (local/dev impersonation for tests).
  4. Dev fallback to the first user in the DB (only with
  5. --dev-bootstrap=true).

#Endpoint groups

GroupEndpointsDoc
Auth/api/auth/magic/{request,consume}, /api/auth/github/{start,callback}auth
Profile/api/meprofiles
Workspaces/api/workspaces, /api/workspaces/{id}workspaces
Moderation/api/workspaces/{id}/moderation/membersmoderation
Bots/api/workspaces/{id}/bots, /api/bots/{id}/tokens, /api/bot-tokens/{id}/revokebots
App installs/api/workspaces/{id}/app-installations, /api/app-installations/{id}/revokeintegrations
Slash commands/api/workspaces/{id}/slash-commands, /api/slash-commands/{id}/revoke, /api/hooks/slash/{channel}integrations
Event subscriptions/api/workspaces/{id}/event-subscriptions, /api/event-subscriptions/{id}/{revoke,deliveries}integrations
Audit log/api/workspaces/{id}/audit-logintegrations
Connected accounts/api/workspaces/{id}/connected-accounts, /api/connected-accounts/{id}/revokeintegrations
Topics/api/workspaces/{id}/topicsmessages
Channels/api/workspaces/{id}/channels, /api/channels/{id}workspaces
Messages/api/channels/{id}/messages, /api/messages/{id}messages
Threads/api/messages/{id}/thread, /api/messages/{id}/thread/repliesthreads
Repliesquoted_message_id on any message-create endpointreplies
Reactions/api/messages/{id}/reactionsreactions
Realtime/api/realtime/{ws,events,ephemeral}realtime
Search/api/searchsearch
Uploads/api/uploads, /api/messages/{id}/attachmentsuploads
DMs/api/dms, /api/dms/{id}/messagesdms
Integrations/api/hooks/mattermost/{channel}integrations

#Conventions

  • All payloads are JSON unless explicitly multipart (uploads) or
  • form-encoded (slash commands).

  • Mutating endpoints return both the affected resource and the durable event
  • emitted ({message, event}), so clients can reconcile optimistically.

  • Pagination on listings uses cursor-style sequence numbers (after_seq for
  • channel/DM messages, after_cursor for events).

  • Errors come back as { "error": "<message>" } with an HTTP status code.
  • Store-level moderation restrictions surface as 403; exhausted guest post
  • budgets surface as 429.

#SDK

TypeScript consumers should use @clickclack/sdk-ts. It depends on neither Svelte nor any HTTP framework. See ../sdk.md.