Errors
Every error response uses the same envelope:
{
"error": {
"code": "validation_error",
"message": "Validation failed",
"details": { "brand": ["can't be blank"] }
}
}
details is only present for validation errors, and is null otherwise.
Error codes
| HTTP status | code | Meaning |
|---|---|---|
| 401 | unauthorized | Missing, malformed, revoked, or expired token |
| 403 | forbidden | Token is missing a required scope |
| 404 | not_found | The resource doesn't exist, isn't yours, or was deleted |
| 422 | validation_error | Request body failed validation — see details |
| 422 | max_codes_reached | You've hit the maximum number of discount codes |
| 429 | rate_limited | Too many requests — see Rate limits |
A 404 is returned both when a resource truly doesn't exist and when it
belongs to another user — the API never reveals whether a given ID belongs
to someone else.