Skip to main content

Authentication

This section is for developers calling the REST API directly. If you want your agent to publish for you, you don't need any of this: follow the agent setup and your agent signs you in with an emailed code.

The API is at:

https://api.opendocs.cc

Every route in this reference is under /api/v1. The machine-readable spec is at https://opendocs.cc/openapi.json (see OpenAPI spec).

Two ways to authenticate​

SchemeHeaderUsed by
API keyAuthorization: Bearer od_live_...Agents, the CLI, scripts, backend jobs
Session cookieSet by signing in at opendocs.ccThe dashboard

Most endpoints accept either. When a request carries both, the session wins. Endpoints that accept only a session are marked session only on their pages; an API key gets 401 unauthorized there. Those are API key management, account deletion, onboarding, profile edits, avatar upload, workspace settings (GET /workspace, GET /workspaces/current, the slug check, and rename, slug, delete, bio, public documents, default sort and the per-field branding routes) and GET /workspace/team/stats.

API keys​

Keys start with od_live_ followed by 32 hex characters:

curl https://api.opendocs.cc/api/v1/me \
-H "Authorization: Bearer od_live_xxxxx"
  • A key acts as you in every workspace you're an active member of. It is recorded against the workspace it was created in, and deleting that workspace deletes the key.
  • Keys don't expire. Revoke one to stop it working.
  • The full key is returned once, when it's created. Afterwards you only see its last four characters.

Ways to get a key: the emailed-code flow below, opendocs login --key with a key from Dashboard → API Keys, or POST /api/v1/api-keys from a session (see API keys).

Authorization: Bearer od_live_xxxxx
Content-Type: application/json
X-OpenDocs-Client: claude-code

X-OpenDocs-Client names the agent or tool making the call, optionally with a detail after a slash: claude-code, cursor, codex, cursor/finance-bot. It's lowercased and must match ^[a-z0-9][a-z0-9._-]{0,31}(/[a-z0-9][a-z0-9._-]{0,30})?$; anything else is ignored, never rejected. It's stored on each version you publish (the dashboard shows "via Claude Code"), on signature requests and Drive saves, and it names the API key the emailed-code flow creates.

IDs (postId, workspaceId, projectId, userId) are UUIDs. Some examples on these pages shorten workspace, project and user IDs to placeholders like ws_123.

Getting a key with an emailed code​

Two unauthenticated calls sign a person in (or sign them up) and return an API key. This is what opendocs login --email does.

curl -X POST https://api.opendocs.cc/api/v1/auth/code/request \
-H 'content-type: application/json' \
-d '{"email": "dana@halvard.example"}'
{
"success": true,
"email": "dana@halvard.example",
"accountExists": false,
"expiresInSeconds": 600,
"message": "We sent a 6-digit sign-in code to dana@halvard.example. Ask the user to paste it, then call /api/v1/auth/code/verify."
}
curl -X POST https://api.opendocs.cc/api/v1/auth/code/verify \
-H 'content-type: application/json' \
-H 'X-OpenDocs-Client: claude-code' \
-d '{"email": "dana@halvard.example", "code": "482913"}'
{
"apiKey": "od_live_0000example0000example0000example",
"keyName": "claude-code",
"keyId": "c4e6a8b0-2d4f-4a6c-8e0b-1d3f5a7c9e2b",
"accountCreated": true,
"onboardingCreated": true,
"userId": "usr_123",
"email": "dana@halvard.example",
"username": "dana",
"workspace": { "id": "ws_123", "slug": "dana", "name": "Dana" },
"defaultProject": { "id": "proj_123", "slug": "default", "name": "Default" }
}
FieldNotes
emailRequired on both calls. Trimmed and lowercased, max 320 characters.
code6 digits. Spaces and dashes are stripped, so 482 913 works.
keyNameOptional, 1 to 100 characters. Defaults to the X-OpenDocs-Client value, then to CLI.

A new email gets an account, a username and workspace derived from the address (opendocs.cc/<username>), a Default project and the key. onboardingCreated is true when this call created the workspace.

Codes expire after 10 minutes and allow 5 wrong attempts.

StatuserrorWhen
400invalid_requestMalformed email, or the code isn't 6 digits
400invalid_codeWrong code for this email
400code_expiredThe code is older than 10 minutes
429too_many_attemptsFive wrong codes; request a new one
403signups_disabledNew signups are paused and the email has no account (request step)
409onboarding_incompleteThe account exists but has no workspace yet
429rate_limitedMore than 5 code requests, or 20 verify attempts, per IP in 15 minutes

CLI browser login​

opendocs login --browser

The CLI opens opendocs.cc, where the approval screen shows the signed-in account and workspace. After approval the CLI receives a short-lived one-time code on a 127.0.0.1 callback, exchanges it with its verifier, and stores a normal od_live_ key. The key itself never appears in a browser URL. Agents, CI and headless machines should use the emailed code, OPENDOCS_API_KEY or opendocs login --key instead.

OAuth and the MCP server​

Apps that connect through the OpenDocs MCP server (Claude, ChatGPT, Cursor and others) don't use API keys. They sign the person in with OAuth 2.1: the person signs in to OpenDocs, sees which app is asking, chooses its permissions and clicks Allow. MCP clients do this on their own from the server URL.

WhatWhere
MCP server (the OAuth resource)https://mcp.opendocs.cc/mcp
Protected resource metadatahttps://mcp.opendocs.cc/.well-known/oauth-protected-resource/mcp
Issuerhttps://opendocs.cc/api/auth
Authorization server metadatahttps://opendocs.cc/.well-known/oauth-authorization-server/api/auth

Access tokens are issued for the MCP server, not for direct REST API calls: use an API key for those. People see and revoke connected apps in Dashboard → Connected apps, and a revoked app loses access within a minute. The permissions and tools are listed in MCP tools.

Endpoints that need no auth​

EndpointPage
POST /api/v1/auth/code/request, POST /api/v1/auth/code/verifyThis page
POST /api/v1/anonymous/publish, PUT /api/v1/anonymous/:idAgent endpoints
GET /api/v1/usernames/checkUsernames
GET /api/v1/public/posts/... raw Markdown, GET /api/v1/public/workspaces/:slug/markdown.zipPosts
POST /api/v1/public/posts/.../export/:format, POST /api/v1/tools/convert/pdf|docxExports
POST /api/v1/integrations/docuseal/webhook/:integrationIdIntegrations (called by DocuSeal)
GET /healthz, GET /healthz/converterHealth checks (outside /api/v1)

The public routes also accept auth, so a signed-in caller can read their own non-public documents through them.

Auth failures​

A missing, malformed or revoked key, or an expired session:

{
"error": "unauthorized",
"message": "Missing or invalid credentials. Sign in with `opendocs login --email <you@example.com>` or pass an API key.",
"docs_url": "https://docs.opendocs.cc/errors#unauthorized"
}

Status 401. When you're authenticated but aren't a member of the workspace, or your role can't make the change, you get 403 forbidden (some routes answer 404 not_found instead, so they don't reveal what exists).

Rate limits​

Signed-in routes count per account, everything else per IP. See Errors and pagination for every bucket.