Search Documentation
Search for a documentation page...
Collections API
REST API endpoints for managing product collections.
Collections group products together for display on your storefront (e.g. "Featured", "New Arrivals", "Sale Items"). YNS supports manual collections (products added individually) and several smart collection types that auto-include products based on price range, variant attributes, or recency.
List Collections
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 10 | Collections per page (1-100) |
offset | number | 0 | Collections to skip |
query | string | – | Search by collection name |
active | boolean | – | Filter by active status |
group | string | – | Filter by collection group |
lang | string | – | Locale code for translations (e.g. pl-PL) |
Response
Get Collection
Returns a single collection by UUID or slug, with associated products and translations. Supports ?lang= for translated content.
Create Collection
Creates a product collection. Slug is auto-generated from the name if not provided. Image URLs are downloaded and re-uploaded to the store's CDN.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Collection name |
slug | string | No | URL slug (auto-generated from name) |
description | string | No | Plain text description |
image | string | No | Image URL |
filter | object | No | Filter type (default: { type: "manual" }) |
sortOrder | string | No | Order the storefront lists the products in: manual (the order they were placed in; automatic collections, which have none, list newest first), best-selling (units sold in the last year), title-ascending, title-descending, price-ascending, price-descending (lowest variant price), created-descending or created-ascending (default: manual). A collection with the slug all sets the order of the all-products page: see orderBy=featured in List Products. |
active | boolean | No | Visible on storefront (default: true) |
group | string | No | Grouping key for organizing collections (1-100 chars) |
Filter Types
| Type | Description |
|---|---|
{ type: "manual" } | Products are manually added |
{ type: "dynamicPrice", min?: number, max?: number } | Products auto-included by price range |
{ type: "variantValues", values: Record<string, string[]> } | Products auto-included when a variant attribute label matches the given values (e.g. { "Color": ["Red", "Blue"] }) |
{ type: "newest", days?: number } | Products created within the last days are auto-included, ordered newest-first. Omit days to include the whole catalog sorted by newest. |
Response (201)
Returns the created collection with full data.
Update Collection
Partially updates a collection by UUID or slug. Only provided fields change. Pass null to clear optional fields like description, image, or group.
Request Body
All fields from Create Collection are accepted and optional.
A collection that the store's Stock-based Pricing rule targets has to stay manual: that rule follows collection membership rows, which only a manual collection has. Changing its filter to a smart type is rejected with a 409 until the collection is removed from the rule in the dashboard.
Response (200)
Returns the updated collection.
Errors
| Status | Condition |
|---|---|
404 | No collection with this UUID or slug in the store |
409 | A collection with this slug already exists, or the collection is targeted by Stock-based Pricing and cannot stop being manual |
List a Collection's Products
Returns the products a collection resolves to, with its own filter applied, in the collection's sortOrder. Unlike GET /api/v1/products?collection=..., it also covers smart collections.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 10 | Products per page (1-100) |
offset | number | 0 | Products to skip |
priceMin | number | – | Minimum variant price, in minor units |
priceMax | number | – | Maximum variant price, in minor units |
vts | string | – | Variant-type filter, encoded as Type1*val1.val2!Type2*val3 |
filter | string | – | Custom field filter, e.g. product.custom.material:wool,silk |
sortOrder | string | collection's sortOrder | Order the products differently, e.g. for a shopper's sort menu. Same values as the sortOrder field above |
expandVariants | boolean | false | Return one row per matching variant instead of one per product |
The response is { "data": [...], "meta": { ... } }, where meta includes count, limit, offset and expandVariants.
Delete Collection
Permanently deletes a collection by UUID or slug.
Response (200)
Translations
Upsert or delete a single locale's translated fields for a collection. See the Localization page for the full field reference, behaviour, and examples.
Import Memberships (CSV)
Bulk-import (collection_slug, product_slug) pairs into manual collections. Idempotent – existing memberships are skipped on re-runs. Rows targeting dynamic-filter collections are rejected per-row.