Skip to main content

Get All Categories

Retrieve a list of all categories with optional search filtering.
curl -X GET "https://cemac-api.vercel.app/categories?search=" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: GET Endpoint: /categories

Query Parameters

Search term to filter categories by name

Response

success
boolean
Indicates if the request was successful
categories
array
Array of category objects
total
number
Total number of categories
message
string
Response message

Create Category

Create a new category.
curl -X POST https://cemac-api.vercel.app/categories \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Electronics",
    "description": "Electronic devices and accessories"
  }'
Authentication: Required (Bearer Token) Method: POST Endpoint: /categories

Request Body

name
string
required
Category name
description
string
Description of the category

Response

success
boolean
Indicates if the category was created successfully
category
object
Created category object
message
string
Success message

Update Category

Update an existing category’s information.
curl -X PUT https://cemac-api.vercel.app/categories/CATEGORY_ID \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Consumer Electronics",
    "description": "Consumer electronic devices, gadgets, and accessories"
  }'
Authentication: Required (Bearer Token) Method: PUT Endpoint: /categories/{categoryId}

Path Parameters

categoryId
string
required
Unique identifier of the category

Request Body

name
string
Updated category name
description
string
Updated description

Response

success
boolean
Indicates if the category was updated successfully
category
object
Updated category object
message
string
Success message

Delete Category

Delete a category from the system.
curl -X DELETE https://cemac-api.vercel.app/categories/CATEGORY_ID \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: DELETE Endpoint: /categories/{categoryId}

Path Parameters

categoryId
string
required
Unique identifier of the category to delete

Response

success
boolean
Indicates if the category was deleted successfully
categoryId
string
ID of the deleted category
message
string
Success message

Get Category Statistics

Retrieve detailed statistics for a specific category.
curl -X GET https://cemac-api.vercel.app/categories/CATEGORY_ID/stats \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json"
Authentication: Required (Bearer Token) Method: GET Endpoint: /categories/{categoryId}/stats

Path Parameters

categoryId
string
required
Unique identifier of the category

Response

success
boolean
Indicates if the request was successful
category
object
Category details
stats
object
Category statistics including product counts, stock levels, and pricing information
message
string
Response message

Build docs developers (and LLMs) love