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 singleerror object:
| Field | Description |
|---|---|
type | Error category — invalid_request_error, validation_error, or api_error. |
code | Machine-readable code you can switch on — parameter_missing, authentication_required, resource_missing, validation_failed, etc. |
message | Human-readable description of what went wrong. |
param | The offending parameter. Present on parameter and validation errors. |
errors | Field-level validation errors keyed by field name. Present on 422. |
400 — parameter_missing
A required field is absent. Check param for which one. The most common cause is wrapping your body ({"product": {...}}) so the real fields never reach the server — see Conventions.
param.
401 — authentication_required
The token is missing, malformed, or revoked.
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.
404 — resource_missing
The resource doesn’t exist for your account.
prod_…/cus_…/etc., not a raw database id) and that it belongs to your account.
422 — validation_failed
The request was well-formed but the data is invalid. Field errors are listed in errors.
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.
429 — rate_limit_exceeded
You’ve exceeded the rate limit (600 requests per 60-second window, per credential).
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.
500 — api_error
An unexpected server error.
x-request-id header from the response.
Handling errors in the SDK
The SDK throws typed errors with astatusCode 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.

