Skip to main content

Overview

The Categories API allows you to organize products into hierarchical categories. Categories are managed by administrators and are publicly viewable by all users. Base URL: http://localhost:8083

Create category

Create a new product category. Requires ADMIN role.

Body parameters

name
string
required
Category name. Must be unique.
description
string
Optional category description
slug
string
URL-friendly identifier. Auto-generated from name if not provided.
parentId
integer
Parent category ID for creating subcategories. Null for top-level categories.

Example

curl -X POST http://localhost:8083/categories \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Electronics",
    "description": "Electronic devices and accessories",
    "slug": "electronics"
  }'

List categories

Get all categories. No authentication required.

Example

curl http://localhost:8083/categories

Get category by ID

Retrieve a specific category by ID.

Path parameters

categoryId
integer
required
Category ID

Example

curl http://localhost:8083/categories/1

Update category

Update an existing category. Requires ADMIN role.

Path parameters

categoryId
integer
required
Category ID to update

Body parameters

name
string
Updated category name
description
string
Updated description
slug
string
Updated slug
parentId
integer
Updated parent category ID

Example

curl -X PUT http://localhost:8083/categories/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Consumer Electronics",
    "description": "Updated description"
  }'

Delete category

Delete a category. Requires ADMIN role. Cannot delete categories that have products or subcategories.

Path parameters

categoryId
integer
required
Category ID to delete

Example

curl -X DELETE http://localhost:8083/categories/1 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Next steps

Products API

Manage products within categories

Product variants

Manage product variants

Build docs developers (and LLMs) love