Template Docs Commerce APIs Webhooks
Get Started
Get Started

Reorder a product image

POST https://api.squarespace.com/{api-version}/commerce/products/{productId}/images/{imageId}/order

Updates the ordering of a product image on the product details page.

Parameters

If needed, see the "Related endpoints" section to learn how to retrieve resource ids.

{api-version} string
required

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


{productId} string
required

Specifies the Product that owns the ProductImage to update.


{imageId} string
required

Specifies the ProductImage to update.

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/images/456/order" \
  -i \
  -H "Authorization: Bearer YOUR_API_KEY_OR_OAUTH_TOKEN" \
  -H "User-Agent: YOUR_CUSTOM_APP_DESCRIPTION" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{' \
    # Id of the ProductImage that this ProductImage should come after.
    # Must be an id of a ProductImage owned by the same Product.
    # Value may be `null`, which moves the ProductImage to the top of the list.
    '"afterImageId": "789"' \
  '}'

Response example

A response to a successful request will not contain any data.

Status codes and error conditions

204 NO CONTENT

The request was successful. The message body does not contain any data.


400 BAD REQUEST

Type: INVALID_REQUEST_ERROR

Subtype: null
The request body does not conform to the required specification.


404 NOT FOUND

Type: INVALID_REQUEST_ERROR

Subtype: INVALID_ARGUMENT
The ProductImage specified in the URL was not found.


405 METHOD NOT ALLOWED

Type: METHOD_NOT_ALLOWED

Subtype: OPERATION_NOT_ALLOWED_FOR_PRODUCT_TYPE
The Product requested is not a physical Product.

Related endpoints

Ids
To retrieve ids for Products and their ProductImages, use these suggested endpoints:

Images
To replace an existing product image, you must delete the existing product image, then upload a new product image.