---
title: Attribute Events
description: Documentation for attribute-related webhook events
sidebar:
  label: Attribute Events
---

This section covers all webhook events related to attributes, including attribute updates, deletions, and attribute relationships to catalog items.

## Event Types

The following attribute-related events are available:

- `attribute.updated` - Triggered when an attribute is created or modified
- `attribute.deleted` - Triggered when an attribute is deleted
- `attribute_relationship.created` - Triggered when an attribute is linked to catalog items
- `attribute_relationship.deleted` - Triggered when an attribute is unlinked from catalog items

## Attribute Updated Event

The `attribute.updated` event is triggered when an attribute is created or modified.

### Event Structure

```json
{
  "event_type": "attribute.updated",
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Color",
    "description": "Color attribute",
    "key": "color",
    "template_key": "color_template",
    "values": {
      "red": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174002",
          "key": "red",
          "type": "color",
          "value": "Red",
          "translations": {
            "value": [
              {
                "country_code": "us",
                "value": "Red"
              },
              {
                "country_code": "es",
                "value": "Rojo"
              }
            ]
          },
          "image": {
            "id": "123e4567-e89b-12d3-a456-426614174003",
            "url": "https://example.com/images/red.jpg",
            "alt": "Red swatch",
            "status": "active",
            "title": "Red",
            "copyright": "",
            "blurhash": "",
            "created_with_ai": false
          }
        }
      ]
    },
    "translations": {
      "name": [
        {
          "country_code": "us",
          "value": "Color"
        },
        {
          "country_code": "es",
          "value": "Color"
        }
      ],
      "description": [
        {
          "country_code": "us",
          "value": "Color attribute"
        }
      ]
    },
    "filterable": true,
    "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 attribute |
| `name` | string | Display name of the attribute |
| `description` | string | Description of the attribute |
| `key` | string | Unique key identifier for the attribute |
| `template_key` | string | Key of the attribute template the attribute belongs to |
| `values` | object | Attribute values grouped by value key |
| `values[].id` | string | Unique identifier for the attribute value |
| `values[].key` | string | Key of the attribute value group |
| `values[].type` | string | Value type, such as color or text |
| `values[].value` | string | Display value |
| `values[].translations` | object | Localized value |
| `values[].image` | object \| null | Optional image for the value, with `id`, `url`, `alt`, `status`, `title`, `copyright`, `blurhash`, and `created_with_ai` |
| `translations` | object | Localized name and description for the attribute |
| `filterable` | boolean | Whether the attribute can be used for filtering |
| `created_at` | string | Creation timestamp |
| `updated_at` | string | Last update timestamp |

## Attribute Deleted Event

The `attribute.deleted` event is triggered when an attribute is removed from the system.

### Event Structure

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

### Field Descriptions

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

## Attribute Relationship Created Event

The `attribute_relationship.created` event is triggered when an attribute is linked to one or more catalog items.

### Event Structure

```json
{
  "event_type": "attribute_relationship.created",
  "payload": {
    "attribute_id": "123e4567-e89b-12d3-a456-426614174000",
    "item_ids": [
      "123e4567-e89b-12d3-a456-426614174001",
      "123e4567-e89b-12d3-a456-426614174002"
    ]
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `attribute_id` | string | Identifier of the linked attribute |
| `item_ids` | array | Identifiers of the catalog items the attribute was linked to |

## Attribute Relationship Deleted Event

The `attribute_relationship.deleted` event is triggered when an attribute is unlinked from one or more catalog items.

### Event Structure

```json
{
  "event_type": "attribute_relationship.deleted",
  "payload": {
    "attribute_id": "123e4567-e89b-12d3-a456-426614174000",
    "item_ids": [
      "123e4567-e89b-12d3-a456-426614174001",
      "123e4567-e89b-12d3-a456-426614174002"
    ]
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `attribute_id` | string | Identifier of the unlinked attribute |
| `item_ids` | array | Identifiers of the catalog items the attribute was unlinked from |
