Search Documentation

Search for a documentation page...

Categories API

REST API endpoints for managing product categories with nesting support.

Categories organize products into a hierarchy (e.g. "Clothing > Shirts > T-Shirts"). Each product can belong to one category.

List Categories

GET /api/v1/categories

Query Parameters

ParameterTypeDefaultDescription
limitnumber10Categories per page (1-100)
offsetnumber0Categories to skip
querystringSearch by category name
activebooleanFilter by active status

Response

{
"data": [
{
"id": "0191abc0-1234-7def-8000-000000000001",
"name": "Shirts",
"slug": "shirts",
"image": "https://cdn.example.com/shirts.jpg",
"active": true,
"parentId": null,
"translations": []
}
],
"meta": {
"count": 5
}
}

Get Category

GET /api/v1/categories/:idOrSlug

Returns a single category by UUID or slug, with associated products and translations.


Create Category

POST /api/v1/categories

Slug is auto-generated from the name if not provided. Image URLs are downloaded and re-uploaded to the store's CDN. Supports nested categories via parentId.

Request Body

FieldTypeRequiredDescription
namestringYesCategory display name
slugstringNoURL slug (auto-generated from name)
descriptionstringNoPlain text description
imagestringNoCategory image URL
parentIdstringNoParent category UUID for nesting
activebooleanNoVisible on storefront (default: true)
# Top-level category
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Clothing"}' \
https://your-store.yns.store/api/v1/categories

# Nested category
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "T-Shirts",
"parentId": "0191abc0-1234-7def-8000-000000000001"
}' \
https://your-store.yns.store/api/v1/categories

Update Category

PATCH /api/v1/categories/:idOrSlug

Partially updates a category. Only the provided fields are changed.

Request Body

FieldTypeDescription
namestringNew category name
slugstringNew URL slug
descriptionstring | nullDescription (null to clear)
imagestring | nullImage URL (null to clear)
parentIdstring | nullParent category UUID (null for top-level)
activebooleanVisibility on storefront