Update a collection
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/collections/1';const options = { method: 'PUT', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"name":"Summer Collection","description":"Featured products for summer season","type":"manual","image_url":"https://example.com/image.jpg","slug":"summer-collection","status":"draft","search_criteria":{"filters":{"category_code":"apparel.clothing.tops","has_promotion":true,"status":"active"}},"collection_sort":"manual","product_ids":[1,2,3,4,5]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://apibase.ecomweb.app/api/v1/stores/example/collections/1 \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "name": "Summer Collection", "description": "Featured products for summer season", "type": "manual", "image_url": "https://example.com/image.jpg", "slug": "summer-collection", "status": "draft", "search_criteria": { "filters": { "category_code": "apparel.clothing.tops", "has_promotion": true, "status": "active" } }, "collection_sort": "manual", "product_ids": [ 1, 2, 3, 4, 5 ] }'Updates the fields you send and leaves the rest unchanged. For a manual collection, sending product_ids replaces its whole product list in the given order. A slug already used by another collection is rejected with a 400 error.
Required scopes: write:categories
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The collection ID.
The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Collection name
Example
Summer CollectionCollection description
Example
Featured products for summer seasonCollection type
Example
manualCollection image URL
Example
https://example.com/image.jpgURL-friendly slug
Example
summer-collectionCollection status
Search criteria for smart collections. Supports both raw filter strings and structured filter objects.
object
Example
{ "filters": { "category_code": "apparel.clothing.tops", "has_promotion": true, "status": "active" }}How products should be sorted within this collection
Product IDs for manual collections. Required when type is manual.
Example
[ 1, 2, 3, 4, 5]Responses
Section titled “Responses”object
manual collections list products you choose; smart collections select products with search_criteria.
Publication status.
The rules a smart collection selects products with, or null for a manual collection.
object
The facets shoppers can filter the collection by, computed by the store, or null when not yet computed.
object
How products are ordered within the collection.
Product IDs of a manual collection, in display order. Not present on smart collections.
SEO fields. Present only when include_seo_metadata is true.
object
Page title for search engines, or null.
Page description for search engines, or null.
Collection ID.
Collection name.
Collection description, or null.
URL of the collection image, or null.
URL-friendly identifier, unique within the store.
ID of the category this collection was generated from, or null for a collection created by hand.
When the collection was created, as an ISO 8601 timestamp.
When the collection was last updated, as an ISO 8601 timestamp.
Always null; deleted collections are not returned.
Number of products in the collection. Present only when include_product_count is true.
Example
{ "type": "manual", "status": "draft", "collection_sort": "manual"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}