# Introduction

> Base URL, authentication, errors, pagination, idempotency and limits that every Workwae API operation shares.

URL: https://docs.workwae.com/reference

The Workwae API syncs email, calendar and contacts for Gmail and Microsoft 365 accounts, and email for any IMAP/SMTP mailbox. This reference lists every `/v1` operation; the conventions below apply to all of them.

## Base URL

```
https://api.workwae.com
```

Every path starts with `/v1`. Requests and answers are JSON, except downloads.

## Authentication

Send `Authorization: Bearer <credential>` with one of:

- **API key** (`wk_...`) with the `read`, `write`, `send` or `admin` scope.
- **Account token** (`wat_...`), short-lived, acting with every scope on one account. It works for `GET /v1/accounts/{accountId}` and the account's routes under Mail, Identities, Calendar and Contacts (`/v1/accounts/{accountId}/...`).

Each operation names the scope it needs. See [Authentication and API keys](/guides/api-keys).

## Errors

Errors answer `{ defined, code, status, message, data? }`:

- `code` is the stable reason, in snake_case (for example `plan_limit_accounts`). Each reason always answers with the same HTTP status.
- `message` is for people; `data` is present only for reasons that carry details (`invalid_input` lists `data.issues`).
- Each operation lists the reasons it answers with, each with the condition it is answered on.

Every operation can also answer `invalid_input` (400), `unauthenticated` and `api_key_expired` (401), `missing_scope`, `role_forbidden`, `account_token_forbidden`, `account_scope_forbidden` and `mcp_only_key` (403), `payload_too_large` (413), `rate_limited` and `too_many_requests` (429), `internal_error` (500) and `overloaded` (503).

Calendar routes answer `calendar_disabled` while the account's calendar sync is off (`settings.calendarEnabled`), contacts routes answer `contacts_disabled` while its contacts sync is off (`settings.contactsEnabled`), and mail routes answer `mail_disabled` while its mail is off (`settings.mailEnabled`). IMAP accounts have calendar and contacts only through their CalDAV and CardDAV settings.

See [Errors](/guides/errors) for handling and every reason by status.

## Request ids

Every answer carries `X-Request-Id`. Send your own (1 to 128 characters of `A-Z a-z 0-9 . _ : -`) and it is echoed back; otherwise, or when it does not fit, the API generates one. Quote it when you contact support: it names the request in Workwae's logs and in the audit log.

## Pagination

Paged lists answer `{ items, nextCursor }`: pass `nextCursor` back as `cursor` until it is `null`. `limit` sets the page size (50 by default, at most 200, unless the operation says otherwise). See [Pagination](/guides/pagination).

## Idempotency

Authenticated `POST` operations take an `Idempotency-Key` header: 1 to 255 printable ASCII characters without spaces, such as a UUID. Other methods ignore it.

- The first answer to a key is kept for 24 hours for your tenant. The same key, method, path, query and body answers it again with `Idempotent-Replayed: true` instead of acting twice.
- The same key with another method, path, query or body answers `idempotency_key_reused` (422). While the first request still runs: `idempotency_key_in_progress` (409).
- A 5xx or 429 answer is not kept, so retrying with the same key runs the request again.

See [Idempotency](/guides/idempotency).

## Rate limits

- Requests over the plan's API rate, counted per minute for the tenant and for each credential, answer `rate_limited` with `Retry-After`.
- Every counted call answers `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the window ends) for whichever window has fewer requests left.
- Past 16 requests in flight for one credential (a download counts until its body is sent), a request answers `too_many_requests`. When an API process is overloaded: `overloaded`. Both carry `Retry-After` and did nothing, so retrying after it is safe.
- A client address that fails authentication too often in a minute has its bearer tokens refused with `rate_limited` until the minute ends, except API keys that authenticated recently.

See [Rate limits and plan limits](/guides/rate-limits).

## Plans and modules

Every tenant runs under a plan; `GET /v1/usage` shows it.

- Creations beyond its limits answer `plan_limit_accounts`, `plan_limit_sends`, `plan_limit_validations`, `plan_limit_webhooks` or `plan_limit_storage`; a free-tier workspace past the AI it includes answers `plan_limit_ai`; a workspace that has no plan and is not its owner's one Free workspace answers 402 `plan_required` to what adds an account, a send, an AI call or a validation. A connect flow stopped by the account limit returns to your `redirectUri` with `status=error&error=plan_limit_accounts` (or `plan_required`).
- Every plan offers every module: `mail`, `calendar`, `contacts`, `tracking`, `ai`, `meetings` and `sharedMailboxes`. The workspace's owner turns them on and off in the console; tracking is free. `tracking`, `ai` and `sharedMailboxes` ride on mail: without it they are off too.
- Routes of a module the workspace has off answer `plan_module_unavailable`: Mail (mailboxes, messages, threads, drafts, sends, identities, templates, suppression lists, search), Calendar, Contacts, meeting apps and connections, shared mailboxes, AI drafts, and tracking asked for on a send.
- Without a module its settings have no effect: no mail, calendar or contacts sync, no mail, calendar or contacts scopes on connect, no tracking defaults on sends, no reply classification, no mail or tracking events. IMAP and SMTP accounts are mail accounts, so they cannot be connected without mail.
- Shared-mailbox accounts added before `sharedMailboxes` was turned off keep syncing and sending; only adding new ones, and asking for the shared mailbox scope on connect, is refused.

See [Plan limits](/guides/rate-limits#plan-limits) and [Modules](/guides/rate-limits#modules).

## Downloads

Downloads are sent chunked, without `Content-Length`. Sizes are in the message's `size`, each attachment's `size` and an export's `bytes`.

## OAuth redirect URIs

Register these callbacks with your own OAuth apps (one Microsoft app per cloud). The same callbacks serve the platform apps.

```
https://api.workwae.com/connect/callback/google
https://api.workwae.com/connect/callback/microsoft
```

After sign-in the user returns to your `redirectUri`, which must be listed in `settings.redirectUris`, with `status=success&account_id=...&state=...` or `status=error&error=<code>&state=...`. A hosted session without a `redirectUri` ends on Workwae's own confirmation page; read its outcome with `GET /v1/connect-sessions/{sessionId}`. See [Connect accounts](/guides/connect).

## Reference sections

| Area | Sections |
| --- | --- |
| Accounts | [Accounts](/reference/accounts): list, connect, update, sync and mint account tokens. [MCP keys](/reference/mcp-keys): keys for an account's end user. [Connect](/reference/connect) and [Hosted pages](/reference/hosted-pages): hosted and headless connect. [Organization connections](/reference/organization-connections) and [Shared mailboxes](/reference/shared-mailboxes). |
| Mail | [Mail](/reference/mail): mailboxes, messages, threads, search, drafts and the outbox. [Identities](/reference/identities): send-as addresses and mail settings. [Templates](/reference/templates). [Suppressions](/reference/suppressions). |
| Calendar and contacts | [Calendar](/reference/calendar): calendars, events, invitations and free/busy. [Scheduling](/reference/scheduling): links, slots and bookings. [Meeting connections](/reference/meeting-connections) and [Meeting apps](/reference/meeting-apps). [Contacts](/reference/contacts). |
| Events | [Webhooks](/reference/webhooks): endpoints, secrets, delivery log and replay. [Changes](/reference/changes): the change feed. |
| AI | [AI](/reference/ai): draft email text. |
| Administration | [Settings](/reference/settings). [OAuth apps](/reference/oauth-apps). [Exports](/reference/exports). [Usage](/reference/usage). [Audit log](/reference/audit-log). |
