Skip to main content
Every v2 endpoint returns a conventional HTTP status code and a JSON body describing what went wrong. This guide covers the error envelope, the machine-readable code values, the status codes you’ll see, and how to retry transient failures safely.

The error envelope

Every error response uses the same three-field envelope:
Internal details — Postgres/PostgREST driver messages, constraint names, column hints — are never included; they’re logged server-side and masked from the response. Some statuses merge extra fields on top of the envelope — most importantly 429 (see Rate limits and send caps), 402 (reason) and some 409s.
Success responses use a different envelope: single objects return { "data": {...} } and lists return { "data": [...], "meta": { "page", "limit", "total" } }. See Migration from v1.

Error codes

The code field takes exactly one of these values:

Status codes at a glance

The retryable cases are 429, 503 rate_limit_unavailable, 500 and 504, and a 502 that isn’t service_unavailable. Retry a 502 service_unavailable once, and a 409 only when the idempotency key is still in flight. Two 503s share a status but not a remedy, so branch on code, not on the status: rate_limit_unavailable clears on its own, while service_unavailable is a setting on your organization and every retry fails the same way. Everything else in the 4xx range is a client error — retrying without changing the request will fail the same way.

400 Bad request

There are two flavors of 400, distinguished by code — both use the standard envelope.

Automatic schema validation (validation_error)

Request body, query, param, and header validation is generated from each route’s Zod/OpenAPI schema. When validation fails, the failing fields are summarized into the error string as semicolon-separated path: message pairs (capped at the first 10 issues):
The path segment before each : names the offending field (dot-notation for nested fields, (root) for top-level issues). There is no separate structured issues array — the summary string is the contract.

Business-rule failures (bad_request)

Checks that can’t be expressed in the schema (state checks, malformed headers) return bad_request with a specific message, for example:
An Idempotency-Key header outside the allowed 1–255 character range is also a 400 bad_request — see the Idempotency guide.
Branch on code: validation_error means a field in your request doesn’t match the schema (the error string tells you which); bad_request means the request was understood but can’t be performed in the current state.

401 Unauthorized

No API key was supplied — the X-API-KEY header is missing entirely.
Pass your key on every request:
The only unauthenticated routes are GET /v2/health, GET /v2/openapi.json, and GET /v2/docs.

402 Payment required

Endpoints that start an interview — POST /v2/candidates with send_sms/send_email, POST /v2/candidates/{id}/interview, and the deprecated POST /v2/calls — check the organization’s free-trial interview allowance first. When it’s spent, the send is refused with 402 and nothing is queued:
reason says why the allowance is spent. Don’t retry — the allowance doesn’t refill on a timer. Upgrade the plan or contact Classet.

403 Forbidden

403 means a key was sent but the request isn’t allowed. There are two causes. The key didn’t resolve to an active organization — it’s wrong, revoked, or inactive:
Or the organization isn’t entitled to what the request asks for. Creating or updating a job returns 403 when it adds a language the organization hasn’t enabled (Language not enabled for this organization), or turns on AI screening without a plan that includes it (AI screening entitlement required). 401 means “you sent nothing,” 403 means “what you sent isn’t allowed.” Neither should be retried. For a key error, verify the key in Developer Settings. For an entitlement error, change the request or the organization’s plan.

404 Not found

The resource doesn’t exist or belongs to another organization. The v2 API scopes every query to the org behind your API key, so a resource owned by a different org is indistinguishable from one that doesn’t exist — both return 404.
Unknown routes (a typo in the path, a missing /v2 prefix) also return a JSON 404 not_found — never an HTML error page.

409 Conflict

The request collides with current state. Three common cases: A duplicate would be created:
A state precondition isn’t met. Some 409s include an extra context field alongside the envelope:
A request with the same Idempotency-Key is still in flight:
For the first two, re-check state (e.g. fetch the candidate) before retrying rather than blindly resending. For the in-flight idempotency conflict, wait briefly and retry with the same key — once the original completes, the retry replays its response. See the Idempotency guide.
All three cases share code: "conflict", but only the in-flight idempotency key is worth retrying — a duplicate candidate is permanent. Until a distinct code ships, tell them apart by the error text: retry only when it contains already in progress. This text match is a stopgap; when the in-flight case gets its own code, it will be announced in the changelog, and you should switch to it.

422 Unprocessable

The request parses and validates against the schema, but is semantically invalid — you asked for something that can’t be done as specified. For example, sending an interview with neither channel enabled:
Fix the request; retrying unchanged will fail the same way.

429 Rate limits and send caps

429 is a status you should retry, but the body comes in a few shapes depending on which limit you hit. All of them carry code: "rate_limited" on top of the standard envelope and set a Retry-After response header (in seconds) where applicable.

Interview invite cap (send endpoints)

Endpoints that send an interview invite — POST /v2/candidates (with send_sms/send_email), POST /v2/candidates/:id/interview, and the deprecated POST /v2/calls — share one invite budget across the API and the dashboard. The budget is enforced across four windows: per-minute (burst), per-hour (sustained), daily, and monthly. When a send would exceed a window, the request is rejected before any candidate/call record is created:
The Retry-After header (seconds until retry_at) is set on this response — prefer it over parsing retry_at yourself.

Request rate limit

A separate per-org request-rate limiter (when enabled) guards overall throughput:
This response also sets Retry-After plus the standard X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-RateLimit-Used headers, which are present on successful requests too — read them to pace yourself before you ever hit a 429. See Rate limits for the full header semantics, including X-RateLimit-Degraded.
Don’t hard-code which window or limiter produced a 429. Branch on the presence of fields (exceeded_window vs retry_after) and always fall back to the Retry-After header for timing.

503 Rate limiter unavailable

On the invite-sending endpoints, the invite budget fails closed: if the rate-limit backend is unreachable, the send is rejected rather than silently bypassing your caps. You get a 503 with code: "rate_limit_unavailable" and a Retry-After header:
No invite slot is consumed and no candidate/call record is created — the request had no effect, so it’s always safe to retry after Retry-After seconds. This is a transient infrastructure condition, not a limit you exceeded.

503 / 502 Service unavailable

code: "service_unavailable" covers two different conditions. Neither is the transient 503 above, so don’t let a status-only retry loop pick them up. 503 — sends and writes aren’t enabled for your organization. Endpoints that reach outside Classet (sending an interview, stopping an interview, attaching a resume by URL, disqualifying in the ATS, sending a test webhook) check a per-organization switch first:
This is permanent until Classet turns sends on for your organization. Retrying won’t help — ask Classet to enable them. 502 — the connected ATS failed a disqualify. POST /v2/applications/{id}/disqualify writes through to your ATS. When the ATS rejects or fails the write, the API returns 502 with the ATS’s message in error. It may be a transient upstream failure, so retry once after a short wait; if it fails again, treat it as permanent and check the application in the ATS.

5xx Server errors

A 5xx means something failed on our side — typically a database error. The driver message is logged server-side and masked from you:
These are transient by nature. Retry with backoff (below). Every response carries an X-Request-Id header (matching the body’s request_id) — include it when contacting support so we can correlate it to our logs.

Retrying transient failures

Retry 429; 503 with code: "rate_limit_unavailable"; 500 and 504; a 502 whose code isn’t service_unavailable (gateway errors can arrive with no code at all); 502 service_unavailable once; and a 409 whose error says the idempotency key is already in progress. Read the code before you retry a 502 or 503: 503 service_unavailable is permanent. Honor the Retry-After header (seconds) when present; otherwise fall back to exponential backoff with jitter. Never retry other 4xx responses — they won’t succeed without a different request. Never blind-retry POST /v2/onboard. It is the exception to the 500 rule. An AI provider failure partway through returns 500 and can leave the jobs and knowledge entries it already created, and an Idempotency-Key doesn’t help because a 5xx is never cached. Keep it out of any generic retry loop; check GET /v2/jobs and GET /v2/knowledge and clean up before retrying by hand. See Onboard Company. Retrying writes safely. A 5xx on a POST can leave you unsure whether the request took effect. Send an Idempotency-Key header on every POST you might retry: a 5xx outcome is never cached, so the retry re-executes the request cleanly, while a retry of a request that actually succeeded replays the original response instead of acting twice. The TypeScript SDK does all of this for you — it retries GETs automatically and retries writes when you pass { idempotencyKey }.
Idempotency. With an Idempotency-Key, retried POSTs are exactly-once from your perspective: a successful outcome replays, a 5xx outcome re-executes. Without a key, treat send endpoints as at-least-once and reconcile by candidate id/external_id. Full semantics in the Idempotency guide.

Quick rules

  • Branch on body.code (stable) rather than the body.error text (may change).
  • Retry only 429, 503 rate_limit_unavailable, 500, 504, and a 502 that isn’t service_unavailable. Retry 502 service_unavailable once. Never retry 503 service_unavailable. Honor Retry-After; add jitter.
  • Retry a 409 only when its error says the idempotency key is already in progress (a stopgap text match until it gets its own code).
  • Send an Idempotency-Key on every POST you might retry.
  • Watch X-RateLimit-Remaining to slow down before you hit 429.
  • Capture request_id / the X-Request-Id header and send it to support for any 5xx.