Template Docs Commerce APIs Webhooks Tools
Get Started
Get Started

Retrieve all inventory

GET https://api.squarespace.com/{api-version}/commerce/inventory?cursor={c}

Retrieves real-time stock information for all product variants. Stock information is stored in an InventoryItem for each product variant. The response contains up to 50 InventoryItems and supports dynamic cursors for pagination.

Read the Overview to learn more about InventoryItems.

Parameters

{api-version} string
required

See the Inventory API Overview page for the current API version.


cursor={c} string
optional

Identifies where the next page of results should begin. {c} should be the value of pagination.nextPageCursor from a previous response. If this parameter is not present or empty, the endpoint returns up to 50 InventoryItems.

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?cursor=a637d2e4f3c5437fb384b9de5930d705" \
  -H "Authorization: Bearer YOUR_API_KEY_OR_OAUTH_TOKEN" \
  -H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION"

Response example

A successful request generates a response JSON response with an array of InventoryItems and a pagination object.

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 product variants, 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
    }
  ],
  // Provides pagination details for iterating on
  // the InventoryItems available for the merchant site.
  "pagination": {
    // Flag; indicates whether another page of data is available.
    "hasNextPage": true,
    // Cursor to use in a subsequent request; retrieves the next page of data.
    "nextPageCursor": "b342f5367c664d3c99aa56f44f95ab0a",
    // A pre-built URL for applications to request the next page of data.
    "nextPageUrl": "https://api.squarespace.com/1.0/commerce/inventory?cursor=b342f5367c664d3c99aa56f44f95ab0a"
  }
}

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
The cursor parameter contains an invalid value.