Categories & Subcategories
Access product categories and subcategories for organization
Categories & Subcategories
Access product categories and subcategories to organize and filter products effectively.
Note: Category and subcategory endpoints require the
vouchersfeature to be enabled for your account.
List Categories
Get all product categories available in the system. Only active categories are returned.
Endpoint
GET /api/v1/categoriesAuthentication: Bearer token required
All records are returned in a single response. No pagination or query parameters are supported.
Response
[
{
"id": 1,
"name": "Gift Cards"
},
{
"id": 2,
"name": "Mobile Top-up"
},
{
"id": 3,
"name": "Digital Services"
}
]Category Object
| Field | Type | Description |
|---|---|---|
| id | number | Unique category identifier |
| name | string | Category display name |
Examples
curl -X GET "{{host}}/api/v1/categories" \
-H "Authorization: Bearer your_access_token"<?php
function getCategories($accessToken) {
$ch = curl_init('{{host}}/api/v1/categories');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $accessToken
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
?>Get Category by ID
Get details for a specific category. Returns 404 if the category does not exist or is inactive.
Endpoint
GET /api/v1/categories/{id}Authentication: Bearer token required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | number | Yes | Category ID |
Response
{
"id": 1,
"name": "Gift Cards"
}Error Responses
404 Not Found
{
"error": {
"name": "NotFoundError",
"code": "NOT_FOUND",
"message": "Category not found"
}
}500 Internal Server Error
{
"error": {
"name": "InternalServerError",
"code": "INTERNAL_SERVER_ERROR",
"message": "Failed to retrieve category"
}
}Examples
curl -X GET "{{host}}/api/v1/categories/1" \
-H "Authorization: Bearer your_access_token"List Subcategories
Get all subcategories. Only active subcategories are returned.
Endpoint
GET /api/v1/subcategoriesAuthentication: Bearer token required
All records are returned in a single response. No pagination or query parameters are supported.
Response
[
{
"id": 101,
"name": "Retail Stores"
},
{
"id": 102,
"name": "Restaurants"
},
{
"id": 103,
"name": "Entertainment"
}
]Subcategory Object
| Field | Type | Description |
|---|---|---|
| id | number | Unique subcategory identifier |
| name | string | Subcategory display name |
Examples
curl -X GET "{{host}}/api/v1/subcategories" \
-H "Authorization: Bearer your_access_token"Get Subcategory by ID
Get details for a specific subcategory. Returns 404 if the subcategory does not exist or is inactive.
Endpoint
GET /api/v1/subcategories/{id}Authentication: Bearer token required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | number | Yes | Subcategory ID |
Response
{
"id": 101,
"name": "Retail Stores"
}Error Responses
404 Not Found
{
"error": {
"name": "NotFoundError",
"code": "NOT_FOUND",
"message": "Subcategory not found"
}
}500 Internal Server Error
{
"error": {
"name": "InternalServerError",
"code": "INTERNAL_SERVER_ERROR",
"message": "Failed to retrieve subcategory"
}
}Examples
curl -X GET "{{host}}/api/v1/subcategories/101" \
-H "Authorization: Bearer your_access_token"Error Responses
401 Unauthorized
{
"error": {
"name": "UnauthorizedError",
"code": "UNAUTHORIZED",
"message": "Invalid or expired access token"
}
}Next Steps
- Explore Products to see how categories are used
- Use category and subcategory IDs to filter products in the products API