# createCategory

## Overview

Creates a new product category, optionally nested under an existing parent category.

## Modules Commands Used

- `product-management.CreateProductCategory` — validates code uniqueness and parent existence, then persists the new category node

## Exception Handling

| Error Code | Description |
| --- | --- |
| DUPLICATE_CODE | A category with the given code already exists |
| PARENT_NOT_FOUND | The specified parent category does not exist |
| MAX_DEPTH_EXCEEDED | Adding this category would exceed the maximum hierarchy depth |
| MISSING_REQUIRED_FIELD | A required field such as code or name was not provided |
