Contents
Inventory
What you can sell now, per item and location: stock on hand, minus what is reserved for open orders and
the safety stock, never below zero. With channel, the sales channel's allocation rules apply too: only
the locations it sells from, minus the pieces held for other channels, within its caps. Pre-order
quantities are not included.
Base URL, authentication and conventions of this API are on the Commerce API page.
/inventoryGet availability
inventory:read scope.Availability for up to 100 items per call, by SKU or barcode (or both). Only locations with stock or
reservations for the item are listed; an SKU or barcode Nucleo does not know is left out of the answer.
With channel, that sales channel's allocation rules apply. Scope inventory:read.
Query parameters
skustringComma-separated SKUs.
Example:TEE-BLK-M,TEE-BLK-LbarcodestringComma-separated barcodes (EAN/UPC).
Example:8056377587370channelstringA sales channel type (for example
shopify) or the id of a sales channel connection.
Responses
200Availability per item.application/json
HeadersX-Request-IdThe id of this call. Quote it if you contact support; errors repeat it asrequest_id.
channelstring | nullrequireddataarray of objectrequiredAttributes of each item
skustring | nullbarcodestringavailableintegerSum of
availableover the listed locations.incomingintegerPieces on inbound shipments expected in the next 365 days, not yet received.
locationsarray of objectAttributes of each item
location_codestring | nullon_handintegerreservedintegerHeld for open orders.
availableinteger
400The request is not valid:
validation_failed(withdetailsper parameter or field),invalid_cursor,invalid_json(the body is not a JSON object) orunknown_item(withdetailsper line, for examplelines.0). application/jsonHeadersX-Request-IdThe id of this call. Quote it if you contact support; errors repeat it asrequest_id.
errorobjectrequiredChild attributes
codestringrequiredMachine-readable code. Branch on this, never on
message.messagestringrequiredrequest_idstringrequireddetailsobjectFor
validation_failed, the messages per parameter.
401
unauthorized: the key is missing or wrong, or the call comes from an IP outside the connection's allowlist.application/jsonHeadersX-Request-IdThe id of this call. Quote it if you contact support; errors repeat it asrequest_id.
errorobjectrequiredChild attributes
codestringrequiredMachine-readable code. Branch on this, never on
message.messagestringrequiredrequest_idstringrequireddetailsobjectFor
validation_failed, the messages per parameter.
403The key is right but cannot do this:
insufficient_scope(the key lacks the scope of the call),connection_pausedorconnection_not_active(the connection is paused or not turned on yet). application/jsonHeadersX-Request-IdThe id of this call. Quote it if you contact support; errors repeat it asrequest_id.
errorobjectrequiredChild attributes
codestringrequiredMachine-readable code. Branch on this, never on
message.messagestringrequiredrequest_idstringrequireddetailsobjectFor
validation_failed, the messages per parameter.
429
rate_limited: wait for the seconds inRetry-After.application/jsonHeadersX-Request-IdThe id of this call. Quote it if you contact support; errors repeat it asrequest_id.Retry-AfterSeconds to wait before the next call.
errorobjectrequiredChild attributes
codestringrequiredMachine-readable code. Branch on this, never on
message.messagestringrequiredrequest_idstringrequireddetailsobjectFor
validation_failed, the messages per parameter.
curl -X GET 'https://api-commerce.nucleoplatform.com/api/commerce/v1/inventory?sku=TEE-BLK-M%2CTEE-BLK-L&barcode=8056377587370' \
-H "Authorization: Bearer $NUCLEO_ACCESS_TOKEN" \
-H 'Accept: application/json'const res = await fetch("https://api-commerce.nucleoplatform.com/api/commerce/v1/inventory?sku=TEE-BLK-M%2CTEE-BLK-L&barcode=8056377587370", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.NUCLEO_ACCESS_TOKEN}`,
Accept: "application/json",
},
});
const data = await res.json();
console.log(res.status, data);<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://api-commerce.nucleoplatform.com/api/commerce/v1/inventory?sku=TEE-BLK-M%2CTEE-BLK-L&barcode=8056377587370', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('NUCLEO_ACCESS_TOKEN'),
'Accept' => 'application/json',
],
'http_errors' => false,
]);
echo $response->getStatusCode(), PHP_EOL;
echo $response->getBody();{
"channel": null,
"data": [
{
"sku": "TEE-BLK-M",
"barcode": "8056377587370",
"available": 5,
"incoming": 0,
"locations": [
{
"location_code": "WH1",
"on_hand": 6,
"reserved": 1,
"available": 5
}
]
}
]
}{
"error": {
"code": "validation_failed",
"message": "The request is not valid.",
"request_id": "1f7e3c2a-9b8d-4e6f-a5c4-3b2a1d0e9f8c",
"details": {
"status": [
"Must be one of: received, on_hold, in_fulfillment, shipped, delivered, cancellation_requested, cancelled."
]
}
}
}{
"error": {
"code": "unauthorized",
"message": "Missing or invalid API key.",
"request_id": "1f7e3c2a-9b8d-4e6f-a5c4-3b2a1d0e9f8c"
}
}{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the orders:read scope.",
"request_id": "1f7e3c2a-9b8d-4e6f-a5c4-3b2a1d0e9f8c"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests: retry after the number of seconds in Retry-After.",
"request_id": "1f7e3c2a-9b8d-4e6f-a5c4-3b2a1d0e9f8c"
}
}