cirrux

API

Cirrux has a public HTTP API for building on top of your workspace. Requests and responses are JSON, served under the base URL https://api.cirrux.co/public_api. Every endpoint below is versioned under /v1.

Authentication#

Bearer tokens & scopes

Authenticate every request with a bearer token in the Authorization header. Tokens carry scopes that gate what each endpoint can do.

Authorization: Bearer <access-token>
Content-Type: application/json

Two kinds of token exist: workspace API keys (created by a workspace admin, and always starting with cxk_) and user-scoped OAuth access tokens (issued to an app acting on behalf of a signed-in user). A key belongs to the workspace, not to a person. Most endpoints act on a specific user (their profile, drafts, Drive, Calendar, Tasks, Contacts, Documents), so they need a user-scoped OAuth token and answer a workspace API key with 403 forbidden. A workspace API key can do four things today:

  • Read the workspace and its storage, with workspace.read.
  • Read mail with email.read, in the mailboxes the admin chose when creating the key: the mailbox list, threads, messages, attachments, labels, filters, addresses and search. Any other mailbox answers 404 not_found, as if it did not exist, and GET /v1/mailboxes lists only the key’s mailboxes.
  • Change mail with email.write, in those same mailboxes: label and unlabel, archive, move, trash, mark as spam, snooze, mark read and flag, manage the mailbox’s labels and filters, and write drafts. A key cannot change a mailbox’s addresses; that answers 403 forbidden. Every change is recorded as the key’s, so the mail app’s activity feed names the key.
  • Send mail with email.send: send or schedule a draft from one of those mailboxes. A key is no one, so its mail goes out in the mailbox owner’s name for that mailbox, as the web app would send it, and the workspace and mailbox sending limits apply.

The available scopes are:

FieldTypeRequiredDescription
user.profilescopenoRead the signed-in user’s profile, and the workspace they signed in to.
workspace.readscopenoRead the workspace and its storage use.
email.readscopenoRead mailboxes, threads and messages. On a workspace API key, only in the mailboxes it was created for.
email.writescopenoChange mail: labels, read and flag state, moves, drafts, and a mailbox’s labels and filters.
email.sendscopenoSend a draft.
drive.readscopenoList, read and download Drive files and folders, read sharing settings, thumbnails and the changes feed.
drive.createscopenoCreate folders and upload files.
drive.updatescopenoRename, move, recolor and restore files and folders, replace a file’s contents, and create or revoke public links.
drive.deletescopenoTrash and permanently delete files and folders.
calendar.readscopenoRead calendars and the events on them.
calendar.writescopenoCreate, change and delete calendar events.
tasks.readscopenoRead tasks and task lists. Calendar scopes do not reach them.
tasks.writescopenoCreate, change, complete and delete tasks and task lists.
contacts.readscopenoRead addressbooks and contacts.
contacts.writescopenoCreate, change and delete contacts.
docs.readscopenoList and read Cirrux Docs documents.
docs.commentscopenoComment on documents, suggest changes, and withdraw your own suggestions.
docs.writescopenoCreate, edit, rename, trash and restore documents, attach files, and accept or reject suggestions.

Signing people in with OAuth

An app that acts for whoever signs in to it gets a user-scoped token with the OAuth authorization code flow. You need a client ID first: here’s how to get one. It’s a public client with no secret, so PKCE with S256 is required.

Send the user to the authorization endpoint. After they approve, they come back to your redirect URL with code, state and iss.

GET https://api.cirrux.co/oauth/authorize
  ?response_type=code
  &client_id=<client-id>
  &redirect_uri=<redirect-url>
  &scope=user.profile email.read
  &state=<state>
  &code_challenge=<challenge>
  &code_challenge_method=S256

Exchange the code for tokens (form-encoded):

POST https://api.cirrux.co/oauth/token

grant_type=authorization_code&code=<code>&code_verifier=<verifier>
  &redirect_uri=<redirect-url>&client_id=<client-id>

You get an access token that lasts 15 minutes and a refresh token that lasts 30 days. Refresh at the same endpoint with grant_type=refresh_token, refresh_token and client_id. Every refresh returns a new refresh token and retires the old one, so store the new one each time: using a retired one signs the user out.

Don’t send a resource parameter. That is how the MCP server binds its tokens, and those don’t work on this API. You always get a refresh token, so there’s no need to ask for offline_access. The endpoints are also published at https://api.cirrux.co/.well-known/oauth-authorization-server.

Errors#

Error responses

Errors return a non-2xx status and a JSON body with a machine-readable error code and a human error_description. Some errors add extra fields (for example max_size). The API is rate limited to 600 requests per minute per token, and to 60 requests per minute per IP address for requests that carry no bearer token. A 429 carries Retry-After (in seconds) and X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.

{
  "error": "insufficient_scope",
  "error_description": "Required scope: drive.update"
}
StatuserrorWhen
400invalid_jsonThe request body is not valid JSON.
400invalid_bodyThe request body is JSON but not an object.
401invalid_requestThe Authorization header is missing or malformed, or the API key or access token is unknown, expired or revoked.
403forbiddenThe endpoint requires a user-scoped OAuth token.
403insufficient_scopeThe token is missing the scope the endpoint requires.
404not_foundThe resource does not exist or is not visible to you.
422invalid_uuidAn identifier in the path, query string or body is not a valid UUID.
429rate_limitedToo many requests. Wait for Retry-After seconds.

Per-resource error codes (e.g. name_taken, file_too_large, sync_token_invalid) are documented alongside each endpoint.

Reference#

User profile and workspace

Read the signed-in user and their workspace, including profile image URLs, the workspace type and how much of its storage pool is used.

Mail

Read mailboxes, threads, emails and attachments, search them, label, archive, snooze and move them, manage labels, filters and addresses, and write, send and schedule drafts.

Drive

List, upload, download, replace, organize, trash and delete files and folders. Read sharing settings, create and revoke public links, fetch thumbnails, and keep a client in sync with a delta changes feed and push notifications for native sync apps.

Calendar

List a user’s calendars, read what is on them in a time window with recurring series already expanded, and create, change and delete events, a whole series or a single occurrence.

Tasks

Read, create, change, complete and delete a user’s tasks, and manage the task lists they live on, such as the Reminders list every mailbox has.

Contacts

List a user’s addressbooks, find and read their contacts, and create, change and delete contacts with their email addresses, phone numbers, postal addresses, links and birthday.

Documents

Find the Cirrux Docs documents a user owns or has been shared, read them as markdown, edit them, attach files, comment, suggest changes and decide them, create, rename, and move them in and out of Trash.

Webhooks

Get a signed HTTPS callback the moment mail arrives in a mailbox, instead of polling for it. Includes verifying the signature and what happens when your endpoint is down.

The Cirrux CLI is built on these endpoints.