Skip to main content
Every Crevio error returns the same JSON envelope, so you can handle failures the same way everywhere. Read the code to branch programmatically and the errors object to surface field-level problems to users.

The error envelope

When a request fails, the body is a single error object:
Branch on error.code, not message — messages are for humans and may change. When there is no code, branch on type and the HTTP status. Every failed response also returns an x-request-id header; include it when reporting an issue.

parameter_missing

HTTP 400. A required field is absent. Check param for which one.
Fix: include the named param.

parameter_unknown

HTTP 400. The body is wrapped in a resource key; param names it — see Conventions.
Fix: move the nested fields to the top level of the body.

authentication_required

HTTP 401. The token is missing, malformed, or revoked.
Fix: send Authorization: Bearer YOUR_API_TOKEN. Confirm the token wasn’t deleted in Settings → Developer, and that you didn’t leak a trailing newline into the env var.

account_forbidden

HTTP 403. The credential is valid, but the person behind it is not an admin of the account it acts on. Members of an account, such as customers who bought from it, cannot use its API. An API key also gets this once its creator is removed from the account or loses the admin role. Fix: authenticate as an admin of the account. For an API key, have a current admin create a new one.

insufficient_scope

HTTP 403. The OAuth token’s scope does not allow the request. A read_only token can only make GET requests, and no OAuth token can create API keys. Fix: send the user through authorization again and request the read_write scope. Create API keys in Settings → Developer.

plan_required

HTTP 402. The request was valid, but the account’s plan doesn’t include what it asks for — for example, turning off a site’s referral badge below the Business plan, or creating a site past the plan’s site limit. param names the field when one field is responsible. Nothing in the request is applied.
Fix: retrying won’t help. Tell the user which plan the feature needs, or drop the field and resend.

resource_missing

HTTP 404. The resource doesn’t exist for your account.
On POST/PATCH, a 404 almost always means a bad or nil association id in your body — not a routing problem. For example, passing a non-existent product: "prod_xxx" to POST /price_variants returns resource_missing for the product, not for the price-variants route. Double-check every prefixed id you’re sending.
Fix: verify the prefixed id (it must be a prod_…/cus_…/etc., not a raw database id) and that it belongs to your account.

validation_failed

HTTP 422. The request was well-formed but the data is invalid. Field errors are listed in errors.
A classic 422 is publishing a product with no price variant (status: "active" on a product with zero prices). See creation order. Fix: map each key in errors to a form field and show the message inline.

rate_limit_exceeded

HTTP 429. You’ve exceeded the rate limit (600 requests per 60-second window, per credential).
Fix: back off and retry, using the X-RateLimit-Reset header to time your retry. The @crevio/sdk retries with exponential backoff automatically. See Rate limits for the headers and recommended backoff strategy.

resource_busy

HTTP 409, type api_error. Another request was changing the same resource at the same moment, and this one was rolled back so the two could not corrupt each other. It happens when many calls write to one resource in parallel, such as attaching several files to the same experience at once.
Fix: retry the same request after the Retry-After header’s delay. Nothing from the failed attempt was saved. To avoid it, send writes to one resource one after another, or batch them into a single call (for example, one file_ids array instead of one call per file).

Server errors

HTTP 500, type api_error. An unexpected server error. There is no code and no doc_url — nothing about the request is yours to fix.
Fix: retry idempotently. If it persists, report it with the x-request-id header from the response.

Handling errors in the SDK

The SDK throws typed errors with a statusCode you can branch on:

Next steps

Conventions

Most errors trace back to a broken convention.

Quickstart

A clean, error-free first integration.

API reference

Per-endpoint required params and constraints.

Usage & billing

Check credits before calls fail for balance reasons.