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:

JSON
{
  "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:

Response409
{
  "message": "A coupon that has been used cannot be deleted. Set is_active to false instead.",
  "code": "coupon_already_used"
}
The message text is for debugging — do not show it to end users or compare it in your code. Decide by the HTTP status and, on a 422, by the keys of errors.

Status codes

StatusWhen it happens
401Missing Authorization header; invalid, revoked or expired token; or the store is offline.
403The token lacks the ability the route requires, or the store's plan does not include API access.
404The resource does not exist or belongs to another store — the API does not tell the two apart.
409The 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.
422A parameter is invalid: page or per_page out of range, a required field missing, or a value in the wrong format.
429A rate limit was exceeded. Wait for the time given in Retry-After before trying again.
5xxA 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).