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 both manual collections (products added individually) and dynamic collections (products auto-included based on price range).

List Collections

GET /api/v1/collections

Query Parameters

ParameterTypeDefaultDescription
limitnumber10Collections per page (1-100)
offsetnumber0Collections to skip
querystringSearch by collection name
activebooleanFilter by active status
langstringLocale code for translations (e.g. pl-PL)

Response

{
"data": [
{
"id": "0191abc0-1234-7def-8000-000000000001",
"name": "Featured Products",
"slug": "featured-products",
"image": "https://cdn.example.com/featured.jpg",
"filter": { "type": "manual" },
"active": true,
"productCollections": [
{ "productId": "0191abc0-0000-7000-8000-000000000100" }
],
"translations": []
}
],
"meta": {
"count": 1
}
}

Get Collection

GET /api/v1/collections/:idOrSlug

Returns a single collection by UUID or slug, with associated products and translations. Supports ?lang= for translated content.

{
"id": "0191abc0-1234-7def-8000-000000000001",
"name": "Featured Products",
"slug": "featured-products",
"filter": { "type": "manual" },
"active": true,
"productCollections": [
{
"productId": "0191abc0-0000-7000-8000-000000000100",
"product": {
"id": "0191abc0-0000-7000-8000-000000000100",
"name": "Classic Tee",
"slug": "classic-tee"
}
}
]
}

Create Collection

POST /api/v1/collections

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

FieldTypeRequiredDescription
namestringYesCollection name
slugstringNoURL slug (auto-generated from name)
descriptionstringNoPlain text description
imagestringNoImage URL
filterobjectNoFilter type (default: { type: "manual" })
activebooleanNoVisible on storefront (default: true)

Filter Types

TypeDescription
{ type: "manual" }Products are manually added
{ type: "dynamicPrice", min?: number, max?: number }Products auto-included by price range
# Manual collection
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Featured", "filter": {"type": "manual"}}' \
https://your-store.yns.store/api/v1/collections

# Dynamic price collection
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Budget Friendly", "filter": {"type": "dynamicPrice", "max": 50}}' \
https://your-store.yns.store/api/v1/collections

Response (201)

Returns the created collection with full data.