Errors are returned with an appropriate HTTP status and a JSON body in a single, consistent shape:Documentation Index
Fetch the complete documentation index at: https://docs.archyon.app/llms.txt
Use this file to discover all available pages before exploring further.
error field is suitable for display to end users. The code field is populated only when callers are expected to programmatically branch on the failure mode (for example, to render a “Connect Notion” call-to-action when a Notion endpoint reports a missing integration). Generic validation errors omit code.
Status codes
| Status | Meaning |
|---|---|
200 OK | Request succeeded. |
201 Created | Resource created. The response body contains the new resource. |
204 No Content | Successful preflight (CORS) only. |
302 Found | OAuth callback redirect. Only returned by GET /api/auth/notion/callback. |
400 Bad Request | Validation failed, or the request requires organization context the caller does not have. |
401 Unauthorized | The Authorization header is missing, malformed, or references a revoked credential. |
403 Forbidden | The credential is valid but the role attached to it is insufficient for the operation. |
404 Not Found | The resource does not exist, or is not visible to the caller. Some endpoints return 404 instead of 403 to avoid disclosing existence. |
409 Conflict | The operation conflicts with current state — typically a duplicate identifier on create, or a referenced role on delete. |
502 Bad Gateway | An upstream service (currently only Notion) returned an unexpected error. |
503 Service Unavailable | A feature is not configured for the caller’s organization (currently only the Notion integration). |
500 Internal Server Error | Unhandled exception. Includes a request identifier in the response body for support follow-up. |
Hiding existence with 404
For workspaces and API tokens, attempting to operate on a resource the caller cannot read returns404 Not Found instead of 403 Forbidden. This prevents enumeration attacks that could otherwise reveal whether a particular ID is in use.
Error codes
The followingcode values are stable contract. Document any new codes here in the same pull request that introduces them.
no_active_org
The session has no Clerk organization context, and the requested endpoint operates on organization-scoped data.
notion_misconfigured
The caller’s organization has not connected a Notion workspace.
notion_access_denied
Notion rejected an API request, typically because the integration was uninstalled from the workspace or the requested page was not shared with it.
notion_not_found
Notion returned 404 for a specific page or database ID. The integration is otherwise healthy.
bad_notion_url
A submitted URL did not parse as a Notion page or database link.
https://notion.so/… and contains a 32-character hexadecimal identifier.
role_in_use
A stakeholder role cannot be deleted because existing stakeholder links still reference it. The response includes the count of dependent links.
Branching on codes
Production clients should branch oncode rather than the error string, which is subject to wording changes. A typical pattern:
code value not listed above as an unknown error and surface the human-readable error message until your client adds explicit handling.