---
title: Category Hierarchy
url: https://docs.kaltura.com/docs/rich-media-cms-apis/content-management/categories-category-hierarchy
---

## Category Hierarchy


Categories form a tree structure via the `parentId` field. The API automatically computes path fields:

| Field | Example | Description |
|-------|---------|-------------|
| `parentId` | `12345` | Direct parent category ID (`0` for root) |
| `fullName` | `"Media>Training>Onboarding"` | Full path of names separated by `>` |
| `fullIds` | `"100>12345>67890"` | Full path of IDs separated by `>` |
| `depth` | `2` | Distance from root (`0` for root categories) |

### Move a Category


```bash
curl -X POST "$KALTURA_SERVICE_URL/service/category/action/move" \
  -d "ks=$KALTURA_KS" \
  -d "format=1" \
  -d "categoryIds=$CATEGORY_ID" \
  -d "targetCategoryParentId=$TARGET_PARENT_CATEGORY_ID"
```


| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `categoryIds` | string | Yes | Comma-separated category IDs to move |
| `targetCategoryParentId` | integer | Yes | New parent category ID |

Moving a category updates `fullName`, `fullIds`, and `depth` for the category and all its descendants. The category status may temporarily become `1` (UPDATING) during the move operation.

### Traversal Patterns

**List root categories:**

```bash
curl -X POST "$KALTURA_SERVICE_URL/service/category/action/list" \
  -d "ks=$KALTURA_KS" \
  -d "format=1" \
  -d "filter[objectType]=KalturaCategoryFilter" \
  -d "filter[parentIdEqual]=0"
```


**List children of a category:**

```bash
curl -X POST "$KALTURA_SERVICE_URL/service/category/action/list" \
  -d "ks=$KALTURA_KS" \
  -d "format=1" \
  -d "filter[objectType]=KalturaCategoryFilter" \
  -d "filter[parentIdEqual]=$CATEGORY_ID"
```


**List all descendants of a category:**

```bash
curl -X POST "$KALTURA_SERVICE_URL/service/category/action/list" \
  -d "ks=$KALTURA_KS" \
  -d "format=1" \
  -d "filter[objectType]=KalturaCategoryFilter" \
  -d "filter[ancestorIdIn]=$CATEGORY_ID"
```


**Find categories by path prefix:**

```bash
curl -X POST "$KALTURA_SERVICE_URL/service/category/action/list" \
  -d "ks=$KALTURA_KS" \
  -d "format=1" \
  -d "filter[objectType]=KalturaCategoryFilter" \
  -d "filter[fullNameStartsWithIn]=Training>"
```
