Template Docs Commerce APIs Tools
Get Started
Get Started

Retrieving All Inventory

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

Retrieves real-time inventory level information for eligible product variants with support for pagination by cursor. A page can contain up to 50 inventory items and it is guaranteed that subsequent requests to the same URL will return the same objects and ordering, assuming no changes have taken place (e.g. a new variant was added, or one was removed) since the previous request was made.

Parameters

  • cursor optional
    • Type: A string token, returned from the pagination.nextPageCursor of a previous response.
    • Identifies where the next page of results should begin. If this parameter is not present or empty, the first page of inventory data will be returned.

Request Example

curl "https://api.squarespace.com/1.0/commerce/inventory?cursor=a637d2e4f3c5437fb384b9de5930d705" \
  -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 inventory item resources and some pagination details.

{
  "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
    }
  ],
  "pagination": {
    "hasNextPage": true
    "nextPageCursor": "b342f5367c664d3c99aa56f44f95ab0a",
    "nextPageUrl": "https://api.squarespace.com/1.0/commerce/inventory?cursor=b342f5367c664d3c99aa56f44f95ab0a"
  }
}
  • inventory: An array of inventory item objects, which will be empty if the store is not configured with any eligible product variants.
  • pagination: An object containing the following fields:
    • hasNextPage: a flag indicating whether another page of inventory data is available.
    • nextPageCursor nullable: the cursor that would be used in a subsequent request to retrieve the next page of data.
    • nextPageUrl nullable: a pre-built URL that applications can use to automatically request the next page of data.

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. The value contained in the cursor parameter is invalid.