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.

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

The API also has endpoints for mail (mailboxes, threads, emails, labels, filters, drafts, attachments and search), under the scopes listed above. They do not have reference pages here yet. The Cirrux CLI is built on them.