Retrieve specific products (1.0)
GET https://api.squarespace.com/1.0/commerce/products/{ids}
Retrieves information for specific physical products, including information for any variants or images. Up to 50 products can be retrieved per request.
A successful request returns product information in a Product
.
The Product
include any ProductVariants
and ProductImages
as subresources.
Read the Overview to learn more about these resources.
Parameters
If needed, see the "Related endpoints" section to learn how to retrieve resource ids.
See the Products API Overview page for the current API version.
{ids}
string
required
Specifies the Products
to retrieve.
Multiple Products
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/products/123" \
-i \
-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 Products
.
Note: For easier reference between response fields and descriptions, comments were added in the example, though this makes the JSON invalid.
{
// Array of Product resources.
// If the merchant site doesn't have any products, this array is empty.
"products": [
{
// Unique Product id.
"id": "5ed539b66505ca7c5f4a3a5a",
// Product type indicator.
// `PHYSICAL` is the only value supported at this time.
"type": "PHYSICAL",
// Identifier of the product's Store Page.
"storePageId": "5d7ba084a63ee8bb410ce0b1",
// Product name.
"name": "Artisanal Steak Dry Rub",
// Long-form product description represented in HTML.
"description": "<p>This can be a few words or even a few <i>paragraphs</i>.</p>",
// Absolute URL of the product details page.
"url": "https://example.com/store/artisanal-steak-dry-rub",
// URL slug for the new product.
"urlSlug": "artisanal-steak-dry-rub",
// Keywords for search and organization purposes.
"tags": ["artisanal", "steak"],
// Indicates whether the product is available for purchase.
"isVisible": true,
// Options for search engine optimization.
"seoOptions": {
// Page title that appears in search results and browser tabs;
// indexed by search engines.
"title": "Artisanal Cooking",
// Page description that appears below the title or link in search results.
"description": "A one-stop shop for artisanal cooking tips and products."
},
// List of attributes to distinguish variants of the product.
"variantAttributes": ["Flavor"],
// List of variants of the product.
"variants": [{
// Unique ProductVariant id.
"id": "6b76dad2-a15a-4dfc-97e1-47427e12061f",
// Merchant-defined code that identifies the product variant.
"sku": "SQ0557856",
// Pricing data for the variant.
"pricing": {
// Amount per unit charged for the variant.
"basePrice": {
// ISO 4217 currency code string.
"currency": "USD",
// Monetary amount.
"value": "12.95"
},
// Amount per unit charged when the variant is on sale.
"salePrice": {
// ISO 4217 currency code string.
// If `onSale` is false; field defaults to the merchant site's currency setting.
"currency": "USD",
// Monetary amount.
// If `onSale` is false, field coalesces to the lesser of this and `basePrice.value`.
"value": "0.00"
},
// Indicates whether the variant is sold according to its sale price.
"onSale": false
},
// Available stock for the variant.
"stock": {
// Number of units that can be purchased.
"quantity": 10,
// Indicates whether the variant has unlimited stock.
"unlimited": false
},
// Specifies attribute-value pairs for the variant.
"attributes": {
"Flavor": "Habanero"
},
// Measurements of the variant when it's shipped.
"shippingMeasurements": {
// Weight of the variant.
"weight": {
// Unit of measurement.
// Supported values: `KILOGRAM`, `POUND`.
"unit": "POUND",
// Weight amount.
"value": 2.0
},
// Physical dimensions of the variant.
"dimensions": {
// Unit of measurement.
// Supported values: `INCH`, `CENTIMETER`.
"unit": "INCH",
// Length of the variant.
"length": 7.0,
// Width of the variant.
"width": 5.0,
// Height of the variant.
"height": 5.0
}
},
// Product image assigned to the variant.
"image": {
"id": "5ed539bc8367410cdc0c984a",
"title": "Steak",
"url": "https://static1.squarespace.com/static/steak.png",
"originalSize": {
"width": 512,
"height": 256
},
"availableFormats": ["100w", "300w", "500w"]
}
}],
// List of product images.
"images": [{
// Unique ProductImage id.
"id": "5ed539bc8367410cdc0c984a",
// Alt text for the image; impacts SEO and appears in search results.
"altText": "Steak",
// Absolute URL of the image hosted on Squarespace.
"url": "https://static1.squarespace.com/static/steak.png",
// Image size when first uploaded.
"originalSize": {
// Width in pixels.
"width": 512,
// Height in pixels.
"height": 256
},
// Available image sizes. Use with `images.url` and a `format` query parameter
// to retrieve the image at a particular width.
// E.g., https://static1.squarespace.com/static/steak.png?format=300w
"availableFormats": ["100w", "300w", "500w"]
}],
// ISO 8601 UTC date and time string; represents when the Product was created.
"createdOn": "2020-06-01T17:24:06.048Z",
// ISO 8601 UTC date and time string; represents when the Product was last modified.
"modifiedOn": "2020-06-04T20:12:18.163Z"
}
],
// Provides pagination details for iterating on the Products
// available from 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/products?cursor=NTA"
}
}
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: n/a
ids
specifies greater than 50 Products
.
404 NOT FOUND
Type: INVALID_REQUEST_ERROR
Subtype: null
One or more requested Products
were not found.
405 METHOD NOT ALLOWED
Type: METHOD_NOT_ALLOWED
Subtype: OPERATION_NOT_ALLOWED_FOR_PRODUCT_TYPE
One or more requested Products
are not physical Products
.
Related endpoints
To retrieve ids for Products
, the retrieve all products endpoint
is suggested, though other Products API endpoints may be used.