Errors and retries
Status codes, error bodies and which errors are worth retrying.
Status codes
Nucleo uses standard HTTP status codes. Anything in the 2xx range succeeded; 4xx means the request must change before it can succeed; 5xx means something went wrong on our side.
| Code | Meaning | Retry? |
|---|---|---|
200 201 202 | Done. 202 means accepted for processing (for example Collector events). | — |
400 | Malformed request (body that is not JSON or XML, wrong envelope). | No |
401 | Missing, wrong or expired credential. | After fixing the credential |
403 | Valid credential, but not allowed here: wrong origin, feature turned off, scope missing. | No |
404 | Unknown resource, or a feature that is off for this store. | No |
409 | Conflict with the current state (for example an order already acknowledged). | No |
413 | Body too large. | After splitting the request |
422 | Validation failed: the body says which fields. | After fixing the fields |
429 | Rate limit reached. | Yes, after Retry-After |
500 502 503 | Our problem. | Yes, with backoff |
Error body
JSON APIs answer errors with a message and, for validation errors, an errors object with one entry per field:
{
"message": "The country field is required. (and 1 more error)",
"errors": {
"country": ["The country field is required."],
"qty": ["The qty field must be at least 1."]
}
}In the Collector, errors maps each field to a single message string instead of a list.
Some APIs add a machine-readable code or error next to the message. Branch on the code, never on the text of message: the text can be reworded.
The OAuth endpoints follow RFC 6749 and answer {"error": "invalid_grant", "error_description": "…"}.
The Fulfillment API and the Commerce API have one envelope for every error, with the call's request_id (also in the X-Request-Id header): 400 validation_failed with details per field for invalid requests, and, in the Fulfillment API, 422 for valid requests that cannot be applied (for example unknown_item). See Errors in the warehouse guide.
{
"error": {
"code": "validation_failed",
"message": "The request is not valid.",
"request_id": "1f7e3c2a-9b8d-4e6f-a5c4-3b2a1d0e9f8c",
"details": { "lines.0.quantity": ["The lines.0.quantity field must be at least 0."] }
}
}Safe retries
Retrying is safe where the API makes it safe, and each reference page says so:
- Catalog API — send an
Idempotency-Keyheader on writes: the same request with the same key within 48 hours returns the first answer without writing twice. Products are also matched by SKU, so a repeated upsert never creates a duplicate. - Collector — give every event a
uid: an event already received is counted induplicatesand never stored twice. - Tracking webhook — an event identical to one already stored is ignored.
- Fulfillment API — send an
Idempotency-Keyheader onPOSTandPUT: for 48 hours the same key with the same request returns the first answer without doing the work again (Idempotent-Replayed: true), and with a different request answers409. See Retries and idempotency. - Reads (
GET) are always safe to retry.
For every other write, check the outcome before sending the same request again after a timeout.