Category API Reference
Complete API reference for product category endpoints in Omnium, including CRUD operations, tree queries, and scroll search.
This page documents the public API endpoints for managing product categories in Omnium.
Base URL: /api/productcategories
Authentication: All endpoints require authentication. Read operations require ProductRead access; write operations require ProductAdmin access.
Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /{categoryId} | Get a single category |
| GET | / | List all categories (paginated) |
| GET | /GetCategoryTree | Get the full category hierarchy |
| POST | /GetCategoryTreeBySearch | Get hierarchy filtered by product search |
| GET | /{parentId}/SubCategories | Get immediate child categories |
| POST | / | Create a category |
| POST | /AddMany | Batch create categories |
| PUT | / | Update a category |
| DELETE | /{productCategoryId} | Delete a category |
| POST | /ScrollSearch | Scroll search for large result sets |
| GET | /Scroll/{id} | Continue scroll search |
Get Single Category
Retrieve a single category by ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
categoryId | string | Yes | Category ID, with or without language suffix (e.g., mens-shirts or mens-shirts_en) |
language | string | No | Language code (e.g., en, no). Used if categoryId doesn't include language suffix |
Response
Status Codes
| Code | Description |
|---|---|
| 200 | Category found and returned |
| 400 | Invalid category ID |
| 404 | Category not found |
List All Categories
Retrieve all categories with pagination.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
pageSize | int | 1000 | Number of items per page (max 1000) |
page | int | 1 | Page number |
Response
Pagination is limited to 20,000 total items. For larger datasets, use the Scroll Search endpoint.
Get Category Tree
Retrieve the complete category hierarchy with product counts.
Response
Get Category Tree by Search
Retrieve a category tree filtered by product search criteria. Returns only categories containing products that match the search, with accurate counts.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
rootCategoryId | string | No | Override the default root category |
Request Body
Response
Same structure as Get Category Tree, but filtered to only include categories with matching products.
Use Cases
- Show category navigation filtered by current search facets
- Display brand-specific category trees
- Build market-specific navigation
Get Subcategories
Retrieve immediate children of a parent category.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
parentId | string | Yes | Parent category ID. Use rootCategoryId to get top-level categories |
language | string | No | Language code. Defaults to tenant default |
Response
Create Category
Create a new category.
Request Body
Required Fields
| Field | Description |
|---|---|
categoryId | Unique identifier for the category |
Optional Fields
| Field | Default | Description |
|---|---|---|
language | Tenant default | Language code |
parentId | rootCategoryId | Parent category |
name | - | Display name |
description | - | Category description |
sortIndex | 0 | Sort order |
isHidden | false | Hide from end users |
Status Codes
| Code | Description |
|---|---|
| 201 | Category created |
| 400 | Invalid request (missing categoryId, etc.) |
Batch Create Categories
Create multiple categories in a single request.
Request Body
Status Codes
| Code | Description |
|---|---|
| 201 | Categories created |
| 400 | Invalid request |
Update Category
Update an existing category. This performs a full replacement.
Request Body
Same as Create Category. Include all fields you want to preserve.
Status Codes
| Code | Description |
|---|---|
| 200 | Category updated |
| 400 | Invalid request |
This endpoint performs a full replacement. Any fields not included in the request will be reset to defaults or removed.
Delete Category
Delete a single category.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
productCategoryId | string | Yes | Full category ID including language (e.g., mens-shirts_en) |
Status Codes
| Code | Description |
|---|---|
| 200 | Category deleted |
| 400 | Invalid category ID |
| 404 | Category not found |
Deleting a category does not automatically remove it from products or reassign child categories. Handle these cleanup tasks separately.
Scroll Search
Search categories with scroll-based pagination for large result sets.
Request Body
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
take | int | 5000 | Number of items per scroll (max 10,000) |
language | string | - | Filter by language |
parentId | string | - | Filter by parent category |
Response
Continuing the Scroll
Use the scrollId to fetch the next batch:
Continue calling until result is empty or scrollId is null.
Common Use Cases
Build Category Navigation
Create Multi-Language Categories
Export All Categories
Error Handling
All endpoints return standard HTTP status codes. Error responses include a message:
| Status | Description |
|---|---|
| 400 | Bad Request - Invalid parameters or request body |
| 401 | Unauthorized - Missing or invalid authentication |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Category doesn't exist |
| 500 | Server Error - Internal error, retry later |
