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.
- Poll the orders to fulfil — or let a webhook tell you there is a new one.
- Accept each order (or reject it, with a reason).
- Report the picking: quantities, lots, serial numbers, parcels.
- Report the shipment: carrier and tracking. The customer gets the tracking from the sales channel.
- 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:
- 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. - The merchant's locations your warehouse serves are linked to the connection, each with the stock location codes your WMS uses.
- Optionally, your webhook URL (
httpsonly) and your static outbound IPs (IP allowlist) are set on the connection. - The connection is turned on. Until then it is a draft and every call answers
403 connection_not_active; a paused connection answers403 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"const nucleo = async (path, { method = "GET", body, idempotencyKey } = {}) => {
const res = await fetch(`https://api-commerce.nucleoplatform.com/api/fulfillment/v1${path}`, {
method,
headers: {
Authorization: `Bearer ${process.env.NUCLEO_FULFILLMENT_KEY}`,
"Content-Type": "application/json",
...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json();
if (!res.ok) throw Object.assign(new Error(json.error.message), json.error, { status: res.status });
return json;
};
const ping = await nucleo("/ping");
console.log(ping.company.name, ping.locations.map((l) => l.stock_location_codes));<?php
$nucleo = new GuzzleHttp\Client([
'base_uri' => 'https://api-commerce.nucleoplatform.com/api/fulfillment/v1/',
'headers' => ['Authorization' => 'Bearer ' . getenv('NUCLEO_FULFILLMENT_KEY')],
'http_errors' => false,
]);
$ping = json_decode($nucleo->get('ping')->getBody(), true);
echo $ping['company']['name'];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-Keyheader (any unique string, for example a UUID oraccept-1042) onPOSTandPUT. 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/1042and/orders/%231042are different) and same body — returns the first answer without doing the work again, with the headerIdempotent-Replayed: true. The replayed body keeps the originalrequest_id; theX-Request-Idheader 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 answers409 idempotency_key_in_progresswithRetry-After: 1; a key left in progress for more than 2 minutes (a call interrupted half-way) is free again. - Server errors (
5xx) and429are 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."]
}
}
}| Status | Codes | What to do |
|---|---|---|
400 | validation_failed (with details per field), invalid_json, invalid_cursor | Fix the request. Nothing was changed. |
401 | unauthorized | Check the key and the IP allowlist. |
403 | connection_paused, connection_not_active | The merchant paused the connection or has not turned it on: retry later. Nothing was read or changed. |
404 | order_not_found, return_not_found, not_found | It does not exist or belongs to another warehouse. |
405 | method_not_allowed | The path exists with another method: check the reference. |
409 | order_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_progress | The order or return is not in the right state: read it again before deciding. |
413 | payload_too_large | Bodies are limited to 5 MB: split the call. |
422 | unknown_item, too_many_items, labels_not_enabled | Valid JSON that cannot be applied. Nothing was changed. |
429 | rate_limited | Wait the seconds in Retry-After. |
500 | internal_error | Retry 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.