Retrieve specific inventory
GET https://api.squarespace.com/{api-version}/commerce/inventory/{ids}
Retrieves real-time stock information for specific product variants.
Stock information is stored in an InventoryItem
and up to 50 InventoryItems
can be retrieved per request.
Read the Overview to learn more about InventoryItems
.
Parameters
{api-version}
string
required
See the Inventory API Overview page for the current API version.
{ids}
string
required
Specifies the InventoryItems
to retrieve.
Multiple InventoryItems
can be retrieved by providing a comma-separated list:
{id1},{id2}...
, though the same sequence is not guaranteed in the response.
Request example
Read the Making requests guide to learn why specific headers are necessary, and why some are omitted. Every request should also abide by Squarespace rate limits.
curl "https://api.squarespace.com/1.0/commerce/inventory/123" \
-H "Authorization: Bearer YOUR_API_KEY_OR_OAUTH_TOKEN" \
-H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION"
Response example
A successful request generates a JSON response
with an array of the requested InventoryItems
.
Note: For easier reference between response fields and descriptions, comments were added in the example, though this makes the JSON invalid.
{
// Array of InventoryItem resources. If the merchant site doesn't have
// any physical or service products, this array is empty.
"inventory": [
{
// The product variant id, which also serves
// as a unique id for the InventoryItem.
"variantId": "185db2da-c3cf-47f3-8aff-0485082792a5",
// Stock keeping unit (SKU) code assigned by the Squarespace
// merchant for the variant; used to identify an exact variant
// of a product using a naming scheme preferred by the merchant.
"sku": "OO-DEC-GRN",
// Generated description using the product's title and any available
// variant attributes including, but not limited to, color and size.
"descriptor": "Extra Virgin Olive Oil w/ Decanter [Green]",
// Indicates whether stock is currently tracked for the item.
"isUnlimited": false,
// Current amount in stock, or the last known stock amount prior
// to becoming unlimited. This value is modified by purchases and
// returns only when `isUnlimited` is `false`.
"quantity": 34
},
{
"variantId": "7eb25f50-4a0a-4e86-ac7c-cc1d49347bb4",
"sku": "CACAO-WAFER-O2",
"descriptor": "100% Cacao Wafers [Organic, 2lb Bag]",
"isUnlimited": true,
"quantity": 50
}
]
}
Status codes and error conditions
200 OK
The request was successful. The message body contains data in the format specified above.
400 BAD REQUEST
Type: INVALID_REQUEST_ERROR
Subtype: null
ids
specifies greater than 50 InventoryItems
.
404 NOT FOUND
Type: INVALID_REQUEST_ERROR
Subtype: INVALID_ARGUMENT
One or more requested InventoryItems
were not found.