> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enad.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Organisation Events

> Documentation for organisation-related webhook events

This section covers all webhook events related to organisations, including organisation creation, updates, deletions, status changes, and user management.

## Event Types

The following organisation-related events are available:

* `organisations.created` - Triggered when an organisation is created
* `organisations.updated` - Triggered when an organisation is updated
* `organisations.deleted` - Triggered when an organisation is deleted
* `organisation_status.changed` - Triggered when an organisation's status changes
* `organisation_users.added` - Triggered when a user is added to an organisation
* `organisation_users.deleted` - Triggered when a user is removed from an organisation

## Organisation Created Event

The `organisations.created` event is triggered when a new organisation is created in the system.

### Event Structure

```json theme={null}
{
  "event_type": "organisations.created",
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "company_name": "Acme Corporation",
    "contact_name": "John Doe",
    "organisation_number": "123456789",
    "credit_check": true,
    "email": "contact@acme.com",
    "invoice_email": "billing@acme.com",
    "custom_fields": {
      "industry": "Technology",
      "size": "Enterprise"
    },
    "phone": "+1-555-123-4567",
    "tax_id_vat": "US123456789",
    "external_ref": "EXT-001",
    "store_group_ids": [
      "123e4567-e89b-12d3-a456-426614174001",
      "123e4567-e89b-12d3-a456-426614174002"
    ],
    "shipping": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174003",
        "name": "Main Warehouse",
        "company_name": "Acme Corporation",
        "street_address": "123 Business St",
        "co_address": "Suite 100",
        "city": "New York",
        "state_province": "NY",
        "house_number": "123",
        "zip_postal_code": "10001",
        "country": "US",
        "phone": "+1-555-123-4567",
        "is_default": true
      }
    ],
    "billing": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174004",
        "name": "Billing Department",
        "company_name": "Acme Corporation",
        "street_address": "456 Finance Ave",
        "co_address": "Floor 5",
        "city": "New York",
        "state_province": "NY",
        "house_number": "456",
        "zip_postal_code": "10002",
        "country": "US",
        "phone": "+1-555-987-6543",
        "is_default": true
      }
    ],
    "status": "active",
    "attributes": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174005",
        "name": "Industry Type",
        "description": "Type of industry",
        "key": "industry_type",
        "template_key": "industry_template",
        "values": {
          "industry_type": [
            {
              "id": "123e4567-e89b-12d3-a456-426614174006",
              "key": "technology",
              "type": "text",
              "value": "Technology",
              "translations": {
                "value": [
                  {
                    "country_code": "us",
                    "value": "Technology"
                  }
                ]
              }
            }
          ]
        },
        "translations": {
          "name": [
            {
              "country_code": "us",
              "value": "Industry Type"
            }
          ],
          "description": [
            {
              "country_code": "us",
              "value": "Type of industry"
            }
          ]
        },
        "filterable": true,
        "translatable": true,
        "created_at": "2024-02-12T12:00:00Z",
        "updated_at": "2024-02-12T12:00:00Z"
      }
    ],
    "tags": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174007",
        "key": "enterprise",
        "name": "Enterprise",
        "translations": {
          "name": [
            {
              "country_code": "us",
              "value": "Enterprise"
            }
          ]
        },
        "filterable": true,
        "attributes": [],
        "created_at": "2024-02-12T12:00:00Z",
        "updated_at": "2024-02-12T12:00:00Z",
        "status": "active"
      }
    ]
  }
}
```

### Field Descriptions

| Field                 | Type    | Description                                             |
| --------------------- | ------- | ------------------------------------------------------- |
| `id`                  | string  | Unique identifier for the organisation                  |
| `company_name`        | string  | Legal name of the company                               |
| `contact_name`        | string  | Primary contact person name                             |
| `organisation_number` | string  | Official registration number                            |
| `credit_check`        | boolean | Whether credit check is enabled                         |
| `email`               | string  | Primary contact email                                   |
| `invoice_email`       | string  | Email for invoice delivery                              |
| `custom_fields`       | object  | Custom key-value pairs                                  |
| `phone`               | string  | Contact phone number                                    |
| `tax_id_vat`          | string  | Tax identification number                               |
| `external_ref`        | string  | External reference identifier                           |
| `store_group_ids`     | array   | Associated store group identifiers                      |
| `shipping`            | array   | Shipping addresses                                      |
| `billing`             | array   | Billing addresses                                       |
| `status`              | string  | Organisation status (one of: active, pending, inactive) |
| `attributes`          | array   | Associated attributes                                   |
| `tags`                | array   | Associated tags                                         |

## Organisation Updated Event

The `organisations.updated` event is triggered when an organisation is modified. The structure is identical to the created event.

### Event Structure

```json theme={null}
{
  "event_type": "organisations.updated",
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "company_name": "Acme Corporation",
    "contact_name": "John Doe",
    "organisation_number": "123456789",
    "credit_check": true,
    "email": "contact@acme.com",
    "invoice_email": "billing@acme.com",
    "custom_fields": {
      "industry": "Technology",
      "size": "Enterprise"
    },
    "phone": "+1-555-123-4567",
    "tax_id_vat": "US123456789",
    "external_ref": "EXT-001",
    "store_group_ids": [
      "123e4567-e89b-12d3-a456-426614174001",
      "123e4567-e89b-12d3-a456-426614174002"
    ],
    "shipping": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174003",
        "name": "Main Warehouse",
        "company_name": "Acme Corporation",
        "street_address": "123 Business St",
        "co_address": "Suite 100",
        "city": "New York",
        "state_province": "NY",
        "house_number": "123",
        "zip_postal_code": "10001",
        "country": "US",
        "phone": "+1-555-123-4567",
        "is_default": true
      }
    ],
    "billing": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174004",
        "name": "Billing Department",
        "company_name": "Acme Corporation",
        "street_address": "456 Finance Ave",
        "co_address": "Floor 5",
        "city": "New York",
        "state_province": "NY",
        "house_number": "456",
        "zip_postal_code": "10002",
        "country": "US",
        "phone": "+1-555-987-6543",
        "is_default": true
      }
    ],
    "status": "active",
    "attributes": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174005",
        "name": "Industry Type",
        "description": "Type of industry",
        "key": "industry_type",
        "template_key": "industry_template",
        "values": {
          "industry_type": [
            {
              "id": "123e4567-e89b-12d3-a456-426614174006",
              "key": "technology",
              "type": "text",
              "value": "Technology",
              "translations": {
                "value": [
                  {
                    "country_code": "us",
                    "value": "Technology"
                  }
                ]
              }
            }
          ]
        },
        "translations": {
          "name": [
            {
              "country_code": "us",
              "value": "Industry Type"
            }
          ],
          "description": [
            {
              "country_code": "us",
              "value": "Type of industry"
            }
          ]
        },
        "filterable": true,
        "translatable": true,
        "created_at": "2024-02-12T12:00:00Z",
        "updated_at": "2024-02-12T12:00:00Z"
      }
    ],
    "tags": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174007",
        "key": "enterprise",
        "name": "Enterprise",
        "translations": {
          "name": [
            {
              "country_code": "us",
              "value": "Enterprise"
            }
          ]
        },
        "filterable": true,
        "attributes": [],
        "created_at": "2024-02-12T12:00:00Z",
        "updated_at": "2024-02-12T12:00:00Z",
        "status": "active"
      }
    ]
  }
}
```

## Organisation Deleted Event

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

### Event Structure

```json theme={null}
{
  "event_type": "organisations.deleted",
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "org_number": "1234-1234"
  }
}
```

### Field Descriptions

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

## Organisation Status Changed Event

The `organisation_status.changed` event is triggered when an organisation's status changes (e.g., from active to inactive, pending to active, etc.).

### Event Structure

```json theme={null}
{
  "event_type": "organisation_status.changed",
  "payload": {
    "organisation_id": "123e4567-e89b-12d3-a456-426614174000",
    "org_number": "123456789",
    "to_status": "inactive",
    "old_status": "active"
  }
}
```

### Field Descriptions

| Field             | Type   | Description                                                             |
| ----------------- | ------ | ----------------------------------------------------------------------- |
| `organisation_id` | string | Unique identifier of the organisation                                   |
| `org_number`      | string | Organisation registration number                                        |
| `to_status`       | string | New status of the organisation (one of: active, pending, inactive)      |
| `old_status`      | string | Previous status of the organisation (one of: active, pending, inactive) |

## Organisation User Added Event

The `organisation_users.added` event is triggered when a user is added to an organisation.

### Event Structure

```json theme={null}
{
  "event_type": "organisation_users.added",
  "payload": {
    "organisation_id": "123e4567-e89b-12d3-a456-426614174000",
    "user_id": "123e4567-e89b-12d3-a456-426614174008",
    "role": "admin",
    "level": "admin"
  }
}
```

### Field Descriptions

| Field             | Type   | Description                           |
| ----------------- | ------ | ------------------------------------- |
| `organisation_id` | string | Unique identifier of the organisation |
| `user_id`         | string | Unique identifier of the user         |
| `role`            | string | User's role in the organisation       |
| `level`           | string | User's access level (admin, default)  |

## Organisation User Deleted Event

The `organisation_users.deleted` event is triggered when a user is removed from an organisation.

### Event Structure

```json theme={null}
{
  "event_type": "organisation_users.deleted",
  "payload": {
    "organisation_id": "123e4567-e89b-12d3-a456-426614174000",
    "user_id": "123e4567-e89b-12d3-a456-426614174008",
    "role": "admin",
    "level": "admin"
  }
}
```

### Field Descriptions

| Field             | Type   | Description                            |
| ----------------- | ------ | -------------------------------------- |
| `organisation_id` | string | Unique identifier of the organisation  |
| `user_id`         | string | Unique identifier of the removed user  |
| `role`            | string | User's role at time of removal         |
| `level`           | string | User's access level at time of removal |
