# Categories

The Category object represents a taxonomy node used to classify listings and other resources.
Categories can be hierarchical, where each category may contain child categories.

**Sample Category Object**

```json
{
    "id": 12,
    "parent": 0,
    "type": "listings",
    "active": true,
    "image_path": "https://storage.googleapis.com/tradlyapp/assets/category_images/sandbox/table_tennis.png",
    "order_by": 1,
    "sub_category": [],
    "name": "Sports",
    "hierarchy": [
        {
            "id": 12,
            "name": "Sports",
            "level": 1
        }
    ]
}
```

## Category Object

| **attribute** | **type** | **description** |
| --- | --- | --- |
| `id` | `integer` | Unique category ID. |
| `name` | `string` | Category display name. |
| `image_path` | `string` | Public image URL for the category. |
| `parent` | `integer` | Parent category ID. Use `0` for top-level categories. |
| `active` | `boolean` | Whether the category is enabled and visible. |
| `order_by` | `integer` | Sort rank used to order categories. |
| `type` | `string` | Category domain/type (for example `listings`). |
| `sub_category` | `array<Category>` | Child categories under the current category. Empty if none exist. |
| `hierarchy` | `array<Hierarchy>` | Ordered path from root to the current category. |

## Hierarchy Object

| **attribute** | **type** | **description** |
| --- | --- | --- |
| `id` | `integer` | Category ID at this hierarchy level. |
| `name` | `string` | Category name at this hierarchy level. |
| `level` | `integer` | Hierarchy depth level starting from `1`. |