Skip to content

Create a collection

POST
/stores/{storeRef}/collections
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/collections \
--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 ] }'

Creates a manual collection, whose products you list in product_ids (at least one is required), or a smart collection, whose products are selected by search_criteria (required). A slug already used by another collection is rejected with a 400 error.

Required scopes: write:categories

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
name
required

Collection name

string
<= 255 characters

Example

Summer Collection
description

Collection description

string

Example

Featured products for summer season
type
required

Collection type

string
Allowed values: manual smart

Example

manual
image_url

Collection image URL

string

Example

https://example.com/image.jpg
slug
required

URL-friendly slug

string
<= 255 characters

Example

summer-collection
status

Collection status

string
default: draft
Allowed values: draft active archived unlisted
search_criteria

Search criteria for smart collections (required for smart type). Supports both raw filter strings and structured filter objects.

object

Example

{
"filters": {
"category_code": "apparel.clothing.tops",
"has_promotion": true,
"status": "active"
}
}
collection_sort

How products should be sorted within this collection

string
default: manual
Allowed values: manual product_name_asc product_name_desc best_selling highest_price lowest_price newest oldest
product_ids

Product IDs for manual collections. Required when type is manual.

Array<number>

Example

[
1,
2,
3,
4,
5
]
Media typeapplication/json
object
type
required

manual collections list products you choose; smart collections select products with search_criteria.

string
Allowed values: manual smart
status
required

Publication status.

string
Allowed values: draft active archived unlisted
search_criteria
required

The rules a smart collection selects products with, or null for a manual collection.

object
key
additional properties
any
facet_config
required

The facets shoppers can filter the collection by, computed by the store, or null when not yet computed.

object
key
additional properties
any
collection_sort
required

How products are ordered within the collection.

string
Allowed values: manual product_name_asc product_name_desc best_selling highest_price lowest_price newest oldest
product_ids

Product IDs of a manual collection, in display order. Not present on smart collections.

Array<number>
seo_metadata

SEO fields. Present only when include_seo_metadata is true.

object
meta_title
required

Page title for search engines, or null.

string
nullable
meta_description
required

Page description for search engines, or null.

string
nullable
id
required

Collection ID.

number
name
required

Collection name.

string
description
required

Collection description, or null.

string
nullable
image_url
required

URL of the collection image, or null.

string
nullable
slug
required

URL-friendly identifier, unique within the store.

string
generated_from_category_id
required

ID of the category this collection was generated from, or null for a collection created by hand.

number
nullable
created_at
required

When the collection was created, as an ISO 8601 timestamp.

string
updated_at
required

When the collection was last updated, as an ISO 8601 timestamp.

string
deleted_at
required

Always null; deleted collections are not returned.

string
nullable
product_count

Number of products in the collection. Present only when include_product_count is true.

number

Example

{
"type": "manual",
"status": "draft",
"collection_sort": "manual"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

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.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}