Template Docs Commerce APIs Tools
Get Started
Get Started

Retrieving Specific Inventory

GET https://api.squarespace.com/1.0/commerce/inventory/{variantId1},{variantId2}...

Retrieves real-time inventory level information for specific product variants, useful when inventory levels for a few known variants is all that's needed. A request can specify up to 50 variant ids and it's guaranteed that subsequent requests to the same URL will return the same objects, assuming no changes have taken place (e.g. a requested variant was deleted) since the previous request was made. The order of the results is not guaranteed.

Parameters

  • variantId1(,variantId2...)
    • Type: A comma-separated list of variant ids.
    • Specifies the inventory items to retrieve by variant id.

Request Example

curl "https://api.squarespace.com/1.0/commerce/inventory/185db2da-c3cf-47f3-8aff-0485082792a5,7eb25f50-4a0a-4e86-ac7c-cc1d49347bb4" \
  -H "Authorization: Bearer YOUR_SECRET_API_KEY"

Response Format

A response to a successful request will provide a JSON-formatted body containing a list of the requested inventory items.

{
  "inventory": [
    {
      "variantId": "185db2da-c3cf-47f3-8aff-0485082792a5",
      "sku": "OO-DEC-GRN",
      "descriptor": "Extra Virgin Olive Oil w/ Decanter [Green]",
      "isUnlimited": false,
      "quantity": 34
    },
    {
      "variantId": "7eb25f50-4a0a-4e86-ac7c-cc1d49347bb4",
      "sku": "CACAO-WAFER-O2",
      "descriptor": "100% Cacao Wafers [Organic, 2lb Bag]",
      "isUnlimited": true,
      "quantity": 50
    }
  ]
}
  • inventory: An array of the requested inventory item objects. The ordering of the returned objects is unspecified.

Status Codes & 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
      1. No variant ids were specified.
      2. Greater than 50 variant ids were specified.
  • 404 NOT FOUND
    • Type: INVALID_REQUEST_ERROR
    • Subtype: INVALID_ARGUMENT
      1. One of more requested inventory items were not found.