Skip to main content

Get All Categories

Retrieves all product categories. Supports hierarchical or flat structure.

Query Parameters

boolean
default:"false"
If set to true, returns categories in a flat list. Otherwise, returns hierarchical structure with parent-child relationships.

Response

boolean
required
Indicates if the request was successful
array
required
Array of category objects
number
Category ID
string
Category name
number
Parent category ID (null for top-level categories)
array
Child categories (only in hierarchical mode)

Get Category by ID

Retrieves a specific category by its ID.

Path Parameters

number
required
The unique identifier of the category

Response

boolean
required
Indicates if the request was successful
object
Category object
number
Category ID
string
Category name
number
Parent category ID

Error Responses


Create Category

Creates a new product category.

Authentication

Note: This endpoint requires appropriate permissions to create categories.

Request Body

string
required
Name of the category
number
Parent category ID (optional, omit for top-level categories)

Response

boolean
required
Indicates if the request was successful
object
Created category object
number
Category ID
string
Category name
number
Parent category ID

Error Responses


Delete Category

Deletes a category. Categories with associated products or subcategories cannot be deleted.

Authentication

Note: This endpoint requires appropriate permissions to delete categories.

Path Parameters

number
required
The unique identifier of the category to delete

Response

boolean
required
Indicates if the request was successful
string
Success message
string
Error message if deletion failed (e.g., category has products or subcategories)

Error Responses