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" }) |
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.
Response (200)
Returns the updated collection.
Delete Collection
Permanently deletes a collection by UUID or slug.
Response (200)
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.