Errors
How the API answers when a request cannot be served: the HTTP status says what happened and the JSON body carries the details.
Body format
Every error answers with a JSON object with a message field. Validation errors (422) also carry errors, with the messages for each invalid field:
{
"message": "The per page field must not be greater than 100.",
"errors": {
"per_page": [
"The per page field must not be greater than 100."
]
}
}When the refusal comes from the record's state (409) or from a limit specific to the endpoint (429), the body also carries code — a stable identifier your code can decide on:
{
"message": "A coupon that has been used cannot be deleted. Set is_active to false instead.",
"code": "coupon_already_used"
}Status codes
| Status | When it happens |
|---|---|
| 401 | Missing Authorization header; invalid, revoked or expired token; or the store is offline. |
| 403 | The token lacks the ability the route requires, or the store's plan does not include API access. |
| 404 | The resource does not exist or belongs to another store — the API does not tell the two apart. |
| 409 | The request is valid, but the record's state does not allow the action — for example, deleting a coupon that was already used. The body carries a stable code explaining why. |
| 422 | A parameter is invalid: page or per_page out of range, a required field missing, or a value in the wrong format. |
| 429 | A rate limit was exceeded. Wait for the time given in Retry-After before trying again. |
| 5xx | A failure on our side. Try again later, with an increasing interval between attempts. |
Rejections are not errors
Validating a license key and redeeming a gift card answer 200 even when the key or the card is rejected — the reason comes in the reason field of the body. The HTTP status only changes when the request itself is wrong (422) or not authorized (401, 403).