Errors
A refusal answers with a 4xx or 5xx status and the same shape every time:
{ "success": false, "message": "limit must be less than or equal to 100", "error": { "name": "ValidationError", "code": "VALIDATION_ERROR", "statusCode": 422, "details": [ { "field": "limit", "message": "limit must be less than or equal to 100", "in": "query" } ] }, "requestId": "1c6f5c88-b45f-4223-b198-6cb0ce24e8ab"}| Field | Meaning |
|---|---|
message |
What went wrong, in plain words you can show or log. |
error.code |
A stable code: branch on this, never on the message. |
error.statusCode |
The HTTP status again. |
error.details |
More, for some codes: every field problem for VALIDATION_ERROR, the products short of stock for INSUFFICIENT_STOCK. |
error.retryAfter |
Seconds to wait, for 429 and TRY_AGAIN. The Retry-After header says the same. |
requestId |
This request’s id, also in the X-Request-Id header. Quote it when you ask us about a request. |
A promo code that can’t be used is not an error when you only check it: POST /promotions/validate
answers 200 with valid: false and a reason.
All codes
Section titled “All codes”| Status | Code | Meaning |
|---|---|---|
| 400 | IDEMPOTENCY_KEY_REQUIRED |
POST /orders came without an Idempotency-Key. |
| 400 | IDEMPOTENCY_KEY_INVALID |
The Idempotency-Key isn’t 8 to 100 letters, digits, dots, colons, dashes or underscores. |
| 400 | INVALID_JSON |
The body isn’t valid JSON. |
| 400 | BAD_REQUEST |
The request is malformed in some other way. |
| 401 | MISSING_API_KEY |
No key was sent. |
| 401 | INVALID_API_KEY |
The key isn’t shaped like a Sabiwave key, or no business holds it. |
| 401 | API_KEY_REVOKED |
The key was revoked. |
| 401 | API_KEY_EXPIRED |
The key was rotated and its grace period is over. |
| 403 | SCOPE_MISSING |
The key isn’t allowed to do this: error.details names the scope it needs. |
| 403 | ORIGIN_NOT_ALLOWED |
A browser called with a publishable key from a website not on the key’s list. |
| 403 | IP_NOT_ALLOWED |
The secret key doesn’t accept calls from this address. |
| 403 | BUSINESS_UNAVAILABLE |
The business can’t take requests just now. |
| 404 | PRODUCT_NOT_FOUND |
No such product on your website (or, in an order, in your catalogue: error.details names the line, such as items[1].productId). |
| 404 | CUSTOMER_NOT_FOUND |
No such customer. |
| 404 | ORDER_NOT_FOUND |
No such website order. |
| 404 | ROUTE_NOT_FOUND |
Nothing answers at this address: check the path and method. |
| 409 | INSUFFICIENT_STOCK |
Not enough stock for the order. |
| 409 | STOCK_BELOW_ZERO |
Not enough stock, and the business asks before selling below zero. |
| 409 | STOCK_BEING_COUNTED |
The stock is frozen for a stock count. |
| 409 | PRODUCT_INACTIVE |
A product in the order isn’t for sale any more. |
| 409 | STORE_CLOSED |
The store selling the order was closed. |
| 409 | NO_OPEN_STORE |
The business has no open store to sell from. |
| 409 | PROMO_… |
The order’s promo code can’t be used: the reasons. |
| 409 | ORDER_PAID |
Money was recorded on the order: it’s cancelled in Sabiwave. |
| 409 | ORDER_NOT_CANCELLABLE |
The order is already delivered, returned or cancelled. |
| 409 | IDEMPOTENCY_KEY_REUSED |
The Idempotency-Key was used for a different request. |
| 409 | IDEMPOTENCY_KEY_IN_PROGRESS |
A request with this Idempotency-Key is still running. |
| 409 | TRY_AGAIN |
Something else changed the same record at the same moment. Nothing was saved. |
| 413 | PAYLOAD_TOO_LARGE |
The body is too large. |
| 415 | UNSUPPORTED_ENCODING |
The body’s encoding isn’t supported: send UTF-8 JSON. |
| 422 | VALIDATION_ERROR |
One or more fields are missing or wrong: error.details lists each as { field, message, in }. A cursor the API didn’t give out is one. |
| 429 | TOO_MANY_REQUESTS |
Over a rate limit. |
| 500 | INTERNAL_ERROR |
Something went wrong on our side. |
| 503 | SERVICE_UNAVAILABLE |
Sabiwave is briefly unavailable. |
What to retry
Section titled “What to retry”429: wait forRetry-Afterseconds, then send it again.409 TRY_AGAINand409 IDEMPOTENCY_KEY_IN_PROGRESS: wait a second, then send it again.500,503, a timeout or a dropped connection: send it again after a pause that grows each time. ForPOST /orders, use the sameIdempotency-Key: if the first attempt went through, you get its answer instead of a second order.- Anything else: don’t retry it unchanged. Fix the request, or tell the shopper what the
messagesays.