Contents

Connect a warehouse

How the Fulfillment API connects your warehouse system to Nucleo: key, retries and errors.

How it works

This API is part of Nucleo Orders. If Orders is not visible in the merchant's Nucleo, ask us to enable it for the company.

The Fulfillment API connects any warehouse management system (WMS) or logistics provider to a merchant on Nucleo Commerce. Your warehouse is the caller: it reads the orders to fulfil and reports back what happened. Nucleo updates the order, tells the sales channel and keeps availability in sync.

  1. Poll the orders to fulfil — or let a webhook tell you there is a new one.
  2. Accept each order (or reject it, with a reason).
  3. Report the picking: quantities, lots, serial numbers, parcels.
  4. Report the shipment: carrier and tracking. The customer gets the tracking from the sales channel.
  5. Keep stock levels up to date, and receive returns.

Before real orders flow, go through the go-live checklist.

Your key only opens the merchant's locations served by your warehouse: you see only your orders, only your lines of orders split with another warehouse, and only the returns coming to you.

Split orders. An order can be split between your warehouse and another one. What works and what the merchant completes by hand is in Orders split across warehouses (v1).

Get a key and authenticate

Nucleo sets up a Fulfillment API connection for your warehouse together with the merchant, and you receive its credentials:

  1. The connection is created for the merchant's company. The endpoint, the API key (nfk_…) and the webhook secret (whsec_…) are shown once: keep them in your secret store, and ask for a rotation if one leaks.
  2. The merchant's locations your warehouse serves are linked to the connection, each with the stock location codes your WMS uses.
  3. Optionally, your webhook URL (https only) and your static outbound IPs (IP allowlist) are set on the connection.
  4. The connection is turned on. Until then it is a draft and every call answers 403 connection_not_active; a paused connection answers 403 connection_paused.

Call the endpoint shown with the credentials: it can be the connection's own host rather than api-commerce.nucleoplatform.com. The examples below use the default one. Send the key as a Bearer token on every call; GET /ping tells you what it opens:

curl https://api-commerce.nucleoplatform.com/api/fulfillment/v1/ping \
  -H "Authorization: Bearer $NUCLEO_FULFILLMENT_KEY"

A missing or wrong key — or a call from an IP outside the allowlist — answers 401. After 30 failed attempts in 5 minutes the calling IP is blocked for the rest of the window. Rotating the credentials replaces the key and the webhook secret at once and invalidates the old ones immediately.

Retries and idempotency

Networks fail. Every write can be retried safely:

  • Send an Idempotency-Key header (any unique string, for example a UUID or accept-1042) on POST and PUT. Keys belong to your connection and last 48 hours. The same key with the same request — same method, same path written the same way (/orders/1042 and /orders/%231042 are different) and same body — returns the first answer without doing the work again, with the header Idempotent-Replayed: true. The replayed body keeps the original request_id; the X-Request-Id header is the new call's.
  • The same key with a different request answers 409 idempotency_key_reused: use a new key for a new request. A key still being processed by a parallel call answers 409 idempotency_key_in_progress with Retry-After: 1; a key left in progress for more than 2 minutes (a call interrupted half-way) is free again.
  • Server errors (5xx) and 429 are not stored: retry them with the same key.
  • Without a key the API is still safe where it matters: accepting, rejecting and cancelling twice change nothing, a shipment is idempotent on its first tracking number, stock levels are absolute and an unannounced return with the same content is created once.

Errors

Every error has the same shape and the right HTTP status. Branch on code, show message to people, and quote request_id (also the X-Request-Id header of every response) when you contact support: it identifies the call in Nucleo's logs, which the merchant can see too.

{
  "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."]
    }
  }
}
StatusCodesWhat to do
400validation_failed (with details per field), invalid_json, invalid_cursorFix the request. Nothing was changed.
401unauthorizedCheck the key and the IP allowlist.
403connection_paused, connection_not_activeThe merchant paused the connection or has not turned it on: retry later. Nothing was read or changed.
404order_not_found, return_not_found, not_foundIt does not exist or belongs to another warehouse.
405method_not_allowedThe path exists with another method: check the reference.
409order_not_ready, order_not_accepted, order_already_accepted, order_cancelled, order_cancel_requested, order_already_shipped, invalid_state, documents_not_ready, labels_not_ready, idempotency_key_reused, idempotency_key_in_progressThe order or return is not in the right state: read it again before deciding.
413payload_too_largeBodies are limited to 5 MB: split the call.
422unknown_item, too_many_items, labels_not_enabledValid JSON that cannot be applied. Nothing was changed.
429rate_limitedWait the seconds in Retry-After.
500internal_errorRetry with backoff (with the same Idempotency-Key); if it persists, contact support with the request_id.

Limits: by default 600 calls per minute per connection, all endpoints together (the merchant can set another limit on the connection); lists return at most 200 items per page; stock updates take at most 500 items.