---
title: Category Events
description: Documentation for category-related webhook events
sidebar:
  label: Category Events
---

This section covers all webhook events related to categories, including category creation, updates, deletions, and relationship changes.

## Event Types

The following category-related events are available:

- `category.create` - Triggered when a new category is created
- `category.update` - Triggered when an existing category is modified
- `category.deleted` - Triggered when a category is deleted
- `category_relationship.created` - Triggered when a product is assigned to a category
- `category_relationship.deleted` - Triggered when a product is removed from a category

## Category Created/Updated Event

The `category.create` and `category.update` events share the same payload structure.

### Event Structure

```json
{
  "event_type": "category.create", // or category.update
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Winter Collection",
    "slug": "winter-collection",
    "full_uri": "clothing/collections/winter-collection",
    "parent_id": "123e4567-e89b-12d3-a456-426614174001",
    "status": "active",
    "translations": {
      "name": [
        {
          "country_code": "us",
          "value": "Winter Collection"
        },
        {
          "country_code": "es",
          "value": "Colección de Invierno"
        }
      ],
      "slug": [
        {
          "country_code": "us",
          "value": "winter-collection"
        },
        {
          "country_code": "es",
          "value": "coleccion-de-invierno"
        }
      ]
    },
    "attributes": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174002",
        "name": "Season",
        "description": "Season attribute",
        "key": "season",
        "template_key": "season_template",
        "values": {
          "season": [
            {
              "id": "123e4567-e89b-12d3-a456-426614174003",
              "key": "winter",
              "type": "season",
              "value": "Winter",
              "translations": {
                "value": [
                  {
                    "country_code": "us",
                    "value": "Winter"
                  },
                  {
                    "country_code": "es",
                    "value": "Invierno"
                  }
                ]
              }
            }
          ]
        },
        "translations": {
          "name": [
            {
              "country_code": "us",
              "value": "Season"
            },
            {
              "country_code": "es",
              "value": "Temporada"
            }
          ],
          "description": [
            {
              "country_code": "us",
              "value": "Season attribute"
            },
            {
              "country_code": "es",
              "value": "Atributo de temporada"
            }
          ]
        },
        "filterable": true,
        "translatable": true,
        "created_at": "2024-02-12T12:00:00Z",
        "updated_at": "2024-02-12T12:00:00Z"
      }
    ],
    "created_at": "2024-02-12T12:00:00Z",
    "updated_at": "2024-02-12T12:00:00Z"
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique identifier for the category |
| `name` | string | Display name of the category |
| `slug` | string | URL-friendly identifier |
| `full_uri` | string | Full path including parent categories |
| `parent_id` | string | ID of the parent category (if any) |
| `status` | string | Category status (active, inactive, draft) |
| `translations` | object | Localized content for the category |
| `attributes` | array | Associated attributes for the category |
| `created_at` | string | Creation timestamp |
| `updated_at` | string | Last update timestamp |

## Category Deleted Event

The `category.deleted` event is triggered when a category is removed from the system.

### Event Structure

```json
{
  "event_type": "category.deleted",
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000"
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique identifier of the deleted category |

## Category Relationship Created Event

The `category_relationship.created` event is triggered when a product is assigned to a category.

### Event Structure

```json
{
  "event_type": "category_relationship.created",
  "payload": {
    "product_id": "123e4567-e89b-12d3-a456-426614174000",
    "category": {
      "id": "123e4567-e89b-12d3-a456-426614174001",
      "name": "Winter Collection",
      "slug": "winter-collection",
      "full_uri": "clothing/collections/winter-collection",
      "parent_id": "123e4567-e89b-12d3-a456-426614174002",
      "status": "active",
      "translations": {
        "name": [
          {
            "country_code": "us",
            "value": "Winter Collection"
          }
        ],
        "slug": [
          {
            "country_code": "us",
            "value": "winter-collection"
          }
        ]
      },
      "attributes": [],
      "created_at": "2024-02-12T12:00:00Z",
      "updated_at": "2024-02-12T12:00:00Z"
    }
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `product_id` | string | ID of the product being assigned |
| `category` | object | Full category object the product is assigned to |

## Category Relationship Deleted Event

The `category_relationship.deleted` event is triggered when a product is removed from a category.

### Event Structure

```json
{
  "event_type": "category_relationship.deleted",
  "payload": {
    "product_id": "123e4567-e89b-12d3-a456-426614174000",
    "category_id": "123e4567-e89b-12d3-a456-426614174001"
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `product_id` | string | ID of the product being removed |
| `category_id` | string | ID of the category the product is removed from |
