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
Thecode 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 of400, 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):
: 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:
Idempotency-Key header outside the allowed 1–255 character range is also a 400 bad_request — see the Idempotency guide.
401 Unauthorized
No API key was supplied — theX-API-KEY header is missing entirely.
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:
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 return404.
/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:409s include an extra context field alongside the envelope:
Idempotency-Key is still in flight:
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: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: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.
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 a503 with code: "rate_limit_unavailable" and a Retry-After header:
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:
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
A5xx means something failed on our side — typically a database error. The driver message is logged server-side and masked from you:
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
Retry429; 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 thebody.errortext (may change). - Retry only
429,503 rate_limit_unavailable,500,504, and a502that isn’tservice_unavailable. Retry502 service_unavailableonce. Never retry503 service_unavailable. HonorRetry-After; add jitter. - Retry a
409only when itserrorsays the idempotency key isalready in progress(a stopgap text match until it gets its owncode). - Send an
Idempotency-Keyon everyPOSTyou might retry. - Watch
X-RateLimit-Remainingto slow down before you hit429. - Capture
request_id/ theX-Request-Idheader and send it to support for any5xx.