Error codes

Docs

A refusal is JSON: { "error": "<one sentence>" }, with a code beside it where a client is expected to branch. Every refusal is Cache-Control: no-store. A row whose code is — is a plain-status refusal with no code.

Project-token routes

Code Status Where Means
— 401 every project-token route The token is missing or unknown; the body is { "error": "Missing sync token" } or "Invalid sync token" (the Figma routes say token). Never 404, so a guess cannot tell a wrong token from a missing project.
plan_required 402 every export route The project owner's account is on the free plan; the body carries feature and plan.
— 400 GET /api/starter, GET /api/kit, GET /api/snapshot A query value is invalid: framework outside the list, a bad name, a malformed or reserved screens list, or pages other than 1.
— 406 GET /api/figma/blocks, GET /api/figma/icons The request did not accept gzip; the blocks snapshot and the icon set are only ever sent compressed.

Agent routes

Code Status Where Means
agent_token_invalid 401 every /api/agent/* route The account token is missing, malformed, unknown, revoked, expired, or minted before a password change or provider unlink. Every cause answers the same body.
agent_scope_missing 403 every /api/agent/* route but /api/agent/token The token does not hold the scope the route needs.
— 404 the per-project kit, snapshot and screen routes The project is not in the account (deleted, or another account’s), or the screen route names no screen of that file name.
— 400 POST /api/agent/projects, the screen route, the kit and snapshot routes The body or query failed validation; the body carries the first issue as error. On create it is also the account already holding its maximum of projects.
invalid_icons 400 POST /api/agent/projects The icons choice names a set, style or weight that set does not offer.
— 409 POST /api/agent/projects/<id>/screens/generate The project already holds its maximum of screens, the screen's current version cannot be read, or the screen is a marketing page and the body did not send pages: true.
rate_limited 429 POST /api/agent/projects Too many projects created this hour; the answer carries Retry-After.
— 413 every route with a body cap The body is over the cap (64 KB for a recipe, 16 KB for a screen, 1 KB on the device routes).

Device authorization

Code Status Where Means
— 404 /api/device/lookup, /api/device/approve The user code is unknown, expired or already used; one answer for all three.
email_unverified 403 /api/device/lookup, /api/device/approve The signed-in account has not proved its email address.
— 403 /api/device/lookup, /api/device/approve The request came from another origin (Cross-site request refused).
invalid_request 400 POST /api/device/token The body is not { "deviceCode" }.
authorization_pending 400 POST /api/device/token Not approved yet; poll again after interval seconds.
slow_down 400 POST /api/device/token Polled before the interval passed; add five seconds and poll again.
access_denied 400 POST /api/device/token The request was denied in the browser.
expired_token 400 POST /api/device/token The code expired, was already used, or the account changed its password since approving.
rate_limited 429 /api/device/code, /api/device/lookup, /api/device/approve Ten starts an hour per address; five wrong codes per account and per address, then a wait that doubles.

AI routes

Code Status Where Means
provider_key_required 402 the AI routes, in the HTTP body or the in-stream error event The account holds no usable key for the provider the request named; the body carries provider.
credits_required 402 the AI routes, in the HTTP body or the in-stream error event No key for the provider, credits could run it, and the balance is short; the body carries price, available and provider.
insufficient_credits 402 the AI routes, in the HTTP body or the in-stream error event The provider refused for lack of credit on the user's own account.
rate_limited 429 the AI routes, in the HTTP body or the in-stream error event The provider is rate-limiting this key, or the app is throttling the caller.
ai_unavailable 503 the AI routes, in the HTTP body or the in-stream error event The server cannot run AI right now; nothing about the cause is disclosed.
generation_failed 502 the AI routes, in the HTTP body or the in-stream error event Everything else: a stall, a refusal, an invalid response, a provider error.

Screens

Code Status Where Means
page_kind_taken 200 the screen generate routes, in the in-stream error event (the stream is already open) The project already has a page of the kind the answer made; open that page and ask for the change there. No credits are charged.
plan_family_changed 200 the screen generate routes, in the in-stream error event (the stream is already open) The answer came back as another kind of screen than the one being changed. No credits are charged.

Audits

Code Status Where Means
audit_running 409 POST /api/audits An audit of this account is already running; the body carries its id.
audit_not_found 404 POST /api/ai/audit-finalize The audit is missing, unowned, unfinished or of an older shape.
figma_import_not_found 404 POST /api/ai/figma-finalize, POST /api/projects/<id>/figma-imports/<importId>/plan, POST /api/projects/<id>/screens/from-figma The Figma read or frame set is missing, belongs to another account (the plugin signed in as one, the browser as another), is older than seven days or is unreadable.

Account and billing

Code Status Where Means
idempotency_conflict 409 every AI route The operation id was already used; start the request again with a fresh one.
stale_session 401 routes that write for the signed-in user The session names a user whose row is gone, or (approving a device) a session a password change has outdated; sign out and in.
already_subscribed 409 POST /api/plans/checkout The account is on Pro already.
subscription_past_due 409 POST /api/plans/checkout The current subscription is past due; the processor is retrying the card.
subscription_active 409 DELETE /api/account A live subscription blocks deletion; cancel it first.
no_billing_account 404 POST /api/plans/portal Nothing was ever bought on this account, so there is no billing portal to open.
payments_unavailable 503 the checkout and portal routes No payment processor is configured, or it refused.