# API errors `/v1`

Source: https://docs.askaniela.com/reference/errors/

Every error response from `/v1/*` has the same shape:

```json
{"error": {"code": "unknown_rule", "message": "Unknown rules: NOPE",
           "details": {"rules": ["NOPE"]}, "request_id": "6cb511c42fb241ec9e04334766829427"}}
```

- `code` - stable machine identifier (below). Clients branch on `code`, never on `message`.
- `message` - human-readable description, max 300 characters; may change without a version bump.
- `details` - optional structured data (e.g. a list of validation errors), `null` if none.
- `request_id` - same as the `X-Request-ID` header; quote it when reporting a problem.

Every `/v1` response (including success and 500) has `X-Request-ID` and `X-API-Version: v1` headers. A client may
send its own `X-Request-ID` (`[A-Za-z0-9._-]{1,128}`) - it is used instead of a generated one.

## Error codes

| HTTP | `code` | When |
|---|---|---|
| 400 | `unknown_rule` | `rules` contains ids outside the catalog; `details.rules` = unknown ids |
| 400 | `unknown_profile` | unknown `profile` (superadmin override only; other callers' `profile` is ignored) |
| 400 | `rule_disabled` | `rules` contains ids disabled in the catalog; `details.rules` = disabled ids |
| 400 | `invalid_webhook_url` | `webhook_url` not https, an IP literal, localhost/internal host, or has credentials |
| 400 | `bad_request` | other request error |
| 400 | `invalid_url` | page `url` rejected before analysis: IP literal, `localhost`, `.local`/`.internal`, credentials, scheme other than http(s), port other than 80/443; `details` = `{url}` |
| 400 | `invalid_key_expiry` | `expires_at` in the past or more than 1 year ahead, or `never_expires` on a non-organization key / by a non-owner/admin |
| 400 | `invalid_idempotency_key` | `Idempotency-Key` header is not 1-255 printable ASCII characters |
| 400 | `invalid_cursor` | `GET /v1/reports` - `cursor` is not a report id from a previous page you can see; send the `X-Next-Cursor` value as is |
| 400 | `registration_failed` | Registration refused; `POST /v1/auth/register` no longer returns it |
| 401 | `unauthorized` | not logged in (JWT `Authorization: Bearer`, API key `Bearer gsj_...` or session cookie) |
| 401 | `invalid_api_key` | `gsj_...` key unknown, wrong secret or checksum, revoked (also after the rotation grace period or a leak report), its project deleted, or a user key whose owner left the organization |
| 401 | `api_key_expired` | the key passed its `expires_at`; create or rotate a key |
| 403 | `csrf_failed` | session-cookie request without a matching `Origin`/`Referer` |
| 403 | `forbidden` | role too low (`require_role`), no permission in the project, or user-only operation (e.g. managing keys) |
| 403 | `ip_not_allowed` | the key has an IP allowlist and the client address is outside it |
| 403 | `insufficient_scope` | API key lacks the required scope (`judge`, `reports:read`, `jobs`, `reports:write`, `projects:read`, `feedback:write`); the message names it and `details` = `{required_scope, key_scopes}`. Scopes are fixed: create a new key with the scope |
| 403 | `org_suspended` | the current organization (from `X-Org-ID`, the only org of the account, or the API key's project) is suspended |
| 403 | `private_project` | `POST /v1/intent/{id}/shares`, `POST /v1/infogain/{id}/shares` - intent and Gain & Gap reports in a private project cannot be shared publicly |
| 403 | `origin_not_allowed` | `POST` lead form - request from an origin that is not allowed |
| 403 | `labels_raw_not_enabled` | `POST /v1/labels/raw` - raw model output is available to selected partners on request; your organization is not enabled |
| 403 | `labels_decide_not_enabled` | `POST /v1/labels/decide` - the decision model is available to selected partners on request; your organization is not enabled |
| 404 | `report_not_found` | `GET /v1/reports/{id}` - no such report; also any id that is not a public id (`rep_…`), e.g. an old integer id |
| 404 | `job_not_found` | `GET /v1/jobs/{id}` - no such job in the caller's projects |
| 404 | `audit_not_found` | `GET /v1/audits/{id}` - no such audit in the caller's projects |
| 404 | `label_batch_not_found` | `GET /v1/labels/batch/{id}`, `results.csv` and `POST .../cancel` - no such label batch in the caller's projects |
| 404 | `page_extras_not_found` | `GET /v1/reports/{id}/page-extras` - no page category or context vector was ordered with this report |
| 404 | `intent_not_found` | `GET /v1/intent/{id}`, exports and `POST /v1/intent/batches/{id}/cancel` - no such intent report or batch in the caller's projects |
| 404 | `share_not_found` | `DELETE /v1/share-links/{id}` (and per report/audit) - no active share link with this id in the caller's organization |
| 404 | `org_not_found` | `X-Org-ID` names an unknown organization, one without the caller's membership, or a different org than the API key's project |
| 404 | `not_found` | path does not exist |
| 404 | `page_not_found` | `POST /v1/audits/{id}/pages/{index}/recheck` - no page with this index in the audit job (in `POST /v1/audits/{id}/pages/recheck` the same code per page in `refused`); `/v1/labels/{run_id}/items/{index}/recheck\|revisions\|agent.md` - no item with this index in the label run, or the run is not in the caller's projects |
| 405 | `method_not_allowed` | wrong HTTP method |
| 409 | `label_batch_running` | `GET /v1/labels/batch/{id}/results.csv` - the batch is still running (or `cancelling`); poll `GET /v1/labels/batch/{id}` |
| 409 | `share_active` | `DELETE /v1/share-links/{id}?purge=true` - the link is still active; revoke it first |
| 409 | `draft_project_mismatch` | Panel draft edit: a draft stays in its project; the API `PUT /v1/audits/{id}/draft` always uses the draft's project |
| 409 | `not_a_draft` | `PUT /v1/audits/{id}/draft`, `POST /v1/audits/{id}/start`: the audit has already started; only a draft can be edited or started |
| 409 | `upgrade_unavailable` | `POST /v1/reports/{id}/upgrade`, `/v1/audits/{id}/upgrade`: nothing to add; `details.reason` = `nothing_to_add` \| `busy` \| `private_mode` \| `no_pages`, `details.estimate` |
| 429 | `evidence_refresh_limited` | `POST /v1/reports/{id}/evidence/refresh`, `/v1/audits/{id}/evidence/refresh`: free evidence refresh limit - one refresh per evidence version and at least 24 h between refreshes of the same report or audit (a refresh that improved nothing does not count). `details` = `{reason: "same_prompt_version" \| "cooldown", retry_after, last_refresh_at, last_prompt_ver, current_prompt_ver}`; header `Retry-After` (s). With `same_prompt_version` a new refresh needs a newer evidence version, `retry_after` is only a hint when to check again |
| 409 | `addon_unavailable` | `POST /v1/reports/{id}/addons`, `/v1/audits/{id}/addons`: this add-on cannot be ordered; `details.reason` = `nothing_to_add` \| `audit_not_finished` \| `indexing_unavailable` \| `no_confirmed_findings` \| `busy` \| `private_mode` |
| 409 | `idempotency_in_progress` | a request with the same `Idempotency-Key` is still running; `Retry-After` |
| 409 | `key_not_active` | `POST /v1/keys/{id}/rotate` on a revoked, expired or already rotated key |
| 409 | `conflict` | resource already exists, e.g. `POST /v1/invites` for an e-mail with an account or a pending invite |
| 409 | `audit_in_progress` | The audit is still running (`queued`, `running`, `pausing`, `paused`, `cancelling`) or its pages are assessed but report parts are still being prepared (`completeness.state` = `finishing`). Refused until it finishes: `POST /v1/audits/{id}/fix-plan` and `GET` when no plan was ordered yet, `?regenerate=true`, `POST /v1/audits/{id}/addons`, `/upgrade`, `/evidence/refresh`, `/indexing`, `/retry-failed`, `/pages/{index}/recheck` (also while the audit is being recalculated), `/shares`, exports `export.html\|pdf\|csv\|json\|zip`, `pruning.csv`, `links.csv`. `Retry-After` in seconds; poll `GET /v1/audits/{id}` |
| 409 | `audit_busy` | `POST /v1/audits/{id}/archive`, `/unarchive`, `DELETE /v1/audits/{id}` - another archive, restore or delete of the same audit is in progress; retry after `Retry-After` (s) |
| 409 | `audit_running` | `DELETE /v1/audits/{id}` - the audit is still running; stop it and wait until it finishes |
| 409 | `job_not_controllable` | `POST /v1/jobs/{id}/pause\|resume\|cancel` and audit equivalents - the job is not in a state that allows it, or the audit has no job |
| 409 | `job_not_retryable` | `POST /v1/audits/{id}/retry-failed` - the job is still running, its settlement is pending, the project is in private mode (addresses not kept), or another retry won the race |
| 409 | `no_failed_pages` | `POST /v1/audits/{id}/retry-failed` - no pages with a fetch error (provider HTTP 5xx / timeout) left to retry; each page has at most 2 retries |
| 409 | `audit_not_recheckable` | `POST /v1/audits/{id}/pages/{index}/recheck`, `POST /v1/audits/{id}/pages/recheck`, `POST /v1/reports/{id}/recheck` - batch, archived or Topicality-only audit, or an audit without page results |
| 409 | `page_not_recheckable` | `POST .../recheck` - the page has no result yet (use `retry-failed`) or its address is no longer stored (private project); Labeler: the original run is still running, the item was cancelled, or it was rejected when the batch was accepted (`error_code`) |
| 409 | `page_check_running` | `POST .../recheck` - this page is already being checked or waits in the organization's queue |
| 409 | `not_recheckable` | `POST /v1/reports/{id}/recheck` - the report is not a page of a site or job audit |
| 409 | `own_key_required` | `POST /v1/intent*` - the organization allows search results only with its own key (`PUT /v1/orgs/{id}/byok/serp/settings`) and has no key for them; refused before any charge |
| 413 | `audit_too_large` | `POST /v1/audits/site` - `pages` over the page limit per audit for your organization (the audit form and the Limits page of the developer panel show it) |
| 413 | `batch_too_large` | `POST /v1/judge/batch` over 10 pages - use `/v1/jobs` |
| 413 | `job_too_large` | `POST /v1/jobs` over 1000 items |
| 413 | `item_too_large` | `POST /v1/jobs`, `/v1/audits/site*` (import `items`): `html`/`text` over 2,000,000 characters per item or 20,000,000 characters per job |
| 413 | `payload_too_large` | other oversized request |
| 422 | `tier_unavailable` | `POST /v1/intent*` - the requested Intent tier is not available yet |
| 422 | `compare_disabled` | `POST /v1/infogain`, `POST /v1/query-pack` with `url` or `text`, `POST /v1/intent*` with tier `compare`: comparison with your page or text is temporarily unavailable (#2930); order the phrase only. Nothing was reserved or charged |
| 422 | `invalid_csv` | `POST /v1/intent/batch/csv` - the CSV has no phrases or a row has a bad market |
| 422 | `idempotency_mismatch` | `Idempotency-Key` already used with a different request body within 24 h |
| 422 | `sitemap_not_found` | `POST /v1/audits/site` - no sitemap URLs for the site |
| 404 | `gsc_not_found` | `/v1/audits/site*` with `gsc` - the Search Console property is not attached to this project (`GET /v1/projects/{id}/gsc`) |
| 409 | `gsc_reauth_required` | `/v1/audits/site*` with `gsc` - Google no longer accepts the connection of this property; connect the Google account again |
| 403 | `gsc_forbidden` | `/v1/audits/site*` with `gsc` - the connected Google account has no access to the property any more |
| 429 | `gsc_quota` | `/v1/audits/site*` with `gsc` - Search Console limit reached; try again in a few minutes |
| 502 | `gsc_unavailable` | `/v1/audits/site*` with `gsc` - Search Console did not respond |
| 422 | `gsc_empty` | `/v1/audits/site*` with `gsc` - no pages for this property, period, host and preset |
| 422 | `invalid_scope` | `/v1/audits/site*` - invalid include/exclude rule (globs only) |
| 422 | `empty_selection` | `POST /v1/audits/site` - no URLs left after include/exclude |
| 422 | `preview_expired` | `/v1/audits/site*` - `preview_id` expired, unknown or from another user/project, and no source given |
| 422 | `validation_error` | body/parameters do not match the schema; `details[]` = `{loc, msg, type}`; `message` and our own `msg` texts in English, Polish with `Accept-Language: pl` |
| 422 | `consent_required` | `POST` lead form - consent checkbox not ticked; `POST /v1/billing/topups` - missing or old `consent_ver` (`details.consent_ver` = current version from `GET /v1/billing/topups/options`) |
| 422 | `topup_below_min` | `POST /v1/billing/topups`: amount below the minimum top-up; `details.min_usd`, `details.max_usd` |
| 422 | `topup_invalid_amount` | `POST /v1/billing/topups`: amount not in whole cents or not positive |
| 422 | `topup_over_limit` | `POST /v1/billing/topups`: the top-up would go over the balance top-up limit (open payment links count until they expire); `details.max_usd` = room left |
| 422 | `promo_invalid` | `POST /v1/billing/topups`: the promotion code cannot be used; `details.reason` = `promo_unknown` \| `promo_inactive` \| `promo_expired` \| `promo_used` \| `promo_scope` \| `promo_floor` \| ... |
| 503 | `billing_unavailable` | `/v1/billing/topups`: card payments are not configured on this server |
| 422 | `empty_rules` | `/v1/audits/site*` - no enabled rules in the selected categories, or no selected rule can be checked on site pages (also in the estimate) |
| 422 | `invalid_request` | `POST /v1/intent*` - `compare_url` without tier `compare`, tier `compare` in a batch or without `compare_url` |
| 422 | `no_rules_for_input` | `POST /v1/judge`, `/v1/judge/batch`, `/v1/jobs` - none of the selected rules can be checked on this input type (text-only rules on a page, page-only rules on pasted text); refused before any charge |
| 422 | `invalid_target` | `POST /v1/jobs` - invalid `targets` query or market |
| 422 | `invalid_tier` | `POST /v1/intent*` - unknown Intent tier |
| 402 | `fix_plan_not_purchased` | `GET\|POST /v1/{reports,audits}/{id}/fix-plan` - the fix plan is a paid add-on and is not bought for this report or audit yet. Nothing is generated or charged. `details` = `{pages, price_usd, purchased: false, order: "POST /v1/{reports,audits}/{id}/fix-plan/order"}`; buy it with that call (or `POST .../addons` with `kind: fix_plan`), then poll `GET .../fix-plan` |
| 503 | `fix_plan_unavailable` | `GET /v1/{reports,audits}/{id}/fix-plan` - the plan could not be generated now (nothing charged, retry) |
| 503 | `export_unavailable` | `GET /v1/audits/{id}/export.json\|.zip` - the export could not be built now (nothing charged, retry later) |
| 503 | `pdf_unavailable` | `GET /v1/intent/{id}/export.pdf` - PDF rendering is unavailable on this server |
| 503 | `idempotency_unavailable` | `Idempotency-Key` sent, but the server's Redis is not configured or unreachable; retry later or without the header |
| 503 | `context_unavailable` | `POST /v1/context` - the embedding profile with thresholds or the requested category engine is not available now; nothing charged, retry later |
| 503 | `labeling_unavailable` | `POST /v1/labels*` - the labeling engine or the requested taxonomy is not available now; nothing charged, retry later |
| 503 | `serp_unavailable` | `POST /v1/intent*` - search results provider unavailable now; nothing charged, retry later |
| 503 | `start_uncertain` | `POST /v1/intent`, `/v1/intent/batch` - the request may have been accepted and its price stays reserved until it is settled; an `Idempotency-Key` does not protect this answer. Check `GET /v1/intent` (or `?batch_id=`) before retrying; a blind retry can order a second paid analysis |
| 507 | `idempotency_result_too_large` | replay of an `Idempotency-Key` answer that had no resource ids and was over 8 MB; find the result with `GET /v1/reports` or `/v1/jobs` |

`POST /v1/auth/register` always answers **202** `{status: "pending", message}` with the same body, whether or not the e-mail has an account, so the status does not reveal existing accounts. The account becomes active only after the link from the e-mail (`POST /v1/auth/confirm {token}` or the panel page `/confirm/{token}`); an existing account gets an informational e-mail instead. Only a password that breaks the rules returns 400 `invalid_password` (checked the same way for every e-mail). An unconfirmed account cannot sign in (`invalid_credentials`).

| HTTP | `code` | When |
|---|---|---|
| 400 | `email_unavailable` | `PATCH /v1/users/me`: the new e-mail cannot be used |
| 400 | `invalid_password` | Password does not meet the rules: min. 8 characters, no name from the e-mail |
| 400 | `invalid_credentials` | Sign-in failed: wrong e-mail or password |
| 400 | `account_not_verified` | Sign-in requires a confirmed e-mail |
| 400 | `invalid_token` | Password reset or e-mail confirmation link invalid or expired (`POST /v1/auth/confirm`) |
| 400 | `recheck_input_required` | `POST /v1/labels/{run_id}/items/{index}/recheck` - the item was checked from `text` or `html`, which we do not keep: send the new `html` or `text` in the body |
| 429 | `rate_limited` | API key rate limit exceeded; headers `Retry-After`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` |
| 429 | `rate_limited` | Too many sign-in, registration, e-mail confirmation or password reset attempts: per IP and per e-mail, 10/min, growing block; header `Retry-After` |
| 429 | `context_rate_limited` | `/v1/context*` per-minute limit: requests per API key (60) and per organization (300); header `Retry-After` |
| 429 | `labels_rate_limited` | `/v1/labels*` per-minute limit: requests per API key (60) and per organization (300), checks per organization (10,000; a batch counts its items); header `Retry-After` |
| 429 | `too_many_active_jobs` | the project or the organization already has the maximum number of queued or running jobs and site audits (the Limits page of the developer panel shows it); `Retry-After`. Page rechecks do not get it - they wait in the organization's queue |
| 429 | `recheck_cooldown` | `POST .../recheck` - the page was checked less than 10 minutes ago; Labeler: less than 60 seconds ago; `Retry-After` |
| 429 | `recheck_busy` | `POST .../recheck` - the organization's page check queue is full (200 checks waiting). Up to 5 checks run at once; more are accepted (202, `status: waiting`) and start in order, so this code means only an overfull queue; `Retry-After` |
| 429 | `recheck_daily_limit` | `POST .../recheck` - daily page checks for this audit reached (as many as the audit has pages, at least 10); run a new audit. Labeler: 20 rechecks of one item per day; start a new check with `POST /v1/labels` |
| 503 | `maintenance` | planned maintenance: new paid orders are paused - every call that would reserve balance (`POST /v1/jobs`, `/v1/batch`, `/v1/audits`, `/v1/intent*`, `/v1/labels*`, `/v1/infogain*`, `/v1/context`, fix plans, add-ons, page rechecks, `POST /v1/billing/topups`). Nothing is charged or created. Header `Retry-After` (s, 30-300; 60 when the end is not set); `details` = `{retry_after, until}` (`until` = ISO 8601 UTC or `null`). Reads (`GET`), shares, sign-in and payment webhooks keep working; jobs already accepted finish. While it lasts, `GET /v1/status` lists a `warning` notice and `/v1/*` responses carry `X-Service-Notice`. The same code comes from our edge proxy when the API itself is briefly unreachable (restart, deploy): `503`, `Retry-After: 30`, `details` = `{retry_after: 30}`, `request_id: null`. Retry after `Retry-After` with the same `Idempotency-Key` (a 503 is never stored) |
| 503 | `spend_cap_reached` | the service's daily safety limit was reached (UTC day); `details` = `{day, spent_usd, cap_usd}`, `Retry-After: 3600`; resets at 00:00 UTC |
| 503 | `beta_budget_reached` | closed beta paused: the shared monthly beta budget is used up (UTC month); message "Beta paused: the monthly beta limit has been reached…" (PL with `Accept-Language: pl`); `details` = `{month, spent_usd, budget_usd}`, `Retry-After: 3600`; checked before every judge, batch, job, site audit, upgrade and JS retry |
| 402 | `insufficient_balance` | the organization's balance cannot cover the start of this call. The balance may go negative down to the allowed negative balance ($5.00): a call starts when balance minus the amount reserved at start (the most this call can cost) is at least -$5.00. Calls already running finish and are charged for what they actually used; unused reservation goes back to the balance and first covers a negative balance. Message e.g. "Not enough balance in this organization: balance -$4.9000, requested up to $0.5000, allowed negative balance $5.00. Top up to continue: https://app.askaniela.com/balance"; `details` = `{subject: "org", period, unit: "usd", limit_usd, used_usd, requested_usd, remaining_usd, balance_usd, reason: "balance", overdraft_usd, topup_url}`. Not retryable until a top-up. `GET /v1/usage` returns `balance.balance_usd` (negative when in debit) and `balance.overdraft_usd` |
| 429 | `quota_exceeded` | spending limit reached: per user, project or organization (organization: a monthly limit exists only when set for the organization; a short balance is 402 `insufficient_balance`), per day or month (UTC); amounts in USD, message e.g. "Monthly limit of $50.00 reached for this organization: used $49.99, balance $120.0000, requested $0.0450."; `details` = `{subject, period, unit: "usd", limit_usd, used_usd, requested_usd, remaining_usd}` (+ `balance_usd` and `reason: "limit"` for `org`); a batch must fit entirely. Usage: `GET /v1/usage`, see [Billing](https://docs.askaniela.com/guide/billing.md) |
| 429 | `fix_plan_regenerate_too_soon` | `POST /v1/{reports,audits}/{id}/fix-plan?regenerate=true` - the plan for this report/audit and language was generated less than 10 minutes ago; `Retry-After` and `details.retry_after` give the seconds to wait |
| 500 | `internal_error` | unexpected server error; generic `message` (see below) |
| 502 | `fetch_failed` | the page at `url` could not be fetched (HTTP error, timeout, DNS; host resolving to a non-public address, redirect to one, body over 10 MB) |
| 502 | `inference_failed` | no rule could be scored (the inference provider failed for every rule); the page is not charged |
| 503 | `unavailable` | service temporarily unavailable |
| 503 | `profile_not_configured` | server misconfiguration: no inference profile configured for this request; not a client error, retry later |
| 503 | `rate_limiter_unavailable` | the request rate limiter is temporarily unavailable; requests are refused rather than let through. Retry later |
| 503 | `queue_unavailable` | `POST /v1/jobs`: the job queue is temporarily unavailable; retry later |
| 503 | `webhooks_unavailable` | `POST /v1/jobs` with `webhook_url`, but the server has no webhook signing secret |

`message` for 500/502 is generic by default; details are in our server log under `request_id`: quote it
when you contact us.

A new code is a non-breaking change (changelog entry); changing the meaning of or removing a code happens only in a
new version. Errors of single pages in a batch are not HTTP errors: they go to `results[].error` (response 200).
Paths outside `/v1` (panel, `/health`) keep their default responses.

## Error codes inside results

Errors of single rules, pages or jobs are not HTTP errors (response 200 or a webhook); the `error` field carries only
a stable code instead of exception text. Possible values:

| Where | `error` | Meaning |
|---|---|---|
| rule result (`rules[].error`, `ok: false`) | `inference_timeout` | the rule was not scored in time; the rule is not charged |
| rule result (`rules[].error`, `ok: false`) | `inference_failed` | the rule could not be scored |
| job item / batch page (`GET /v1/jobs/{id}/results`, `POST /v1/judge/batch` `results[]`, webhook) | `page_failed` | the page could not be judged (fetch errors stay in `fetch_error`) |
| batch page (`POST /v1/judge/batch` `results[]`) | `inference_timeout` | the page was not judged in time |
| job (`error`, webhook `job.finished`) | `job_failed` | the whole job stopped |
| evidence | `evidence_failed`, `fix_failed` | quotes or fix suggestions could not be prepared |
| search intent | `intent_failed` | the intent analysis could not be completed |

New codes may be added (non-breaking); treat unknown values as a generic failure.
