Contents

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.

CodeMeaningRetry?
200 201 202Done. 202 means accepted for processing (for example Collector events).—
400Malformed request (body that is not JSON or XML, wrong envelope).No
401Missing, wrong or expired credential.After fixing the credential
403Valid credential, but not allowed here: wrong origin, feature turned off, scope missing.No
404Unknown resource, or a feature that is off for this store.No
409Conflict with the current state (for example an order already acknowledged).No
413Body too large.After splitting the request
422Validation failed: the body says which fields.After fixing the fields
429Rate limit reached.Yes, after Retry-After
500 502 503Our 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-Key header 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 in duplicates and never stored twice.
  • Tracking webhook — an event identical to one already stored is ignored.
  • Fulfillment API — send an Idempotency-Key header on POST and PUT: 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 answers 409. 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.