# Event Catalog

This page lists every webhook event type currently published by PartsSource. Each event links to its payload object schema, documented in the [Payload Objects](https://docs.partssource.com/documentation/webhooks/payload-objects) reference.

## Event Envelope

Every webhook delivery is wrapped in a standard envelope. Your endpoint receives this structure on every POST request, regardless of event type.

| Field         | JSON Key         | Type           | Required | Description                                                                                                     |
| ------------- | ---------------- | -------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
| EventType     | `event_type`     | string         | Yes      | The event type identifier                                                                                       |
| CompanyId     | `company_id`     | long           | Yes      | Company ID for multi-tenant isolation                                                                           |
| Payload       | `payload`        | object         | Yes      | The event-specific payload ([see objects](https://docs.partssource.com/documentation/webhooks/payload-objects)) |
| OccurredAt    | `occurred_at`    | DateTimeOffset | Yes      | Timestamp when the event occurred                                                                               |
| CorrelationId | `correlation_id` | string         | No       | Correlation ID for tracing across services                                                                      |
| ReferenceId   | `reference_id`   | long           | No       | Reference ID (e.g., line item ID)                                                                               |
| Source        | `source`         | string         | No       | Name of the publishing service/source                                                                           |
| Metadata      | `metadata`       | Dictionary     | No       | Additional metadata                                                                                             |

```json
{
  "event_type": "order.shipment.shipped",
  "company_id": 12345,
  "payload": { ... },
  "occurred_at": "2024-01-15T10:30:00Z",
  "correlation_id": "corr-abc123",
  "reference_id": 100,
  "source": "order-service"
}
```

***

## Active Events

| Event Type                                                                       | Description                        | Payload Object                                                                                                      |
| -------------------------------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| [`order.created`](#ordercreated)                                                 | A new order was placed             | [Order](https://docs.partssource.com/documentation/payload-objects#order)                                           |
| [`order.approval.submitted`](#orderapprovalsubmitted)                            | An order approval was submitted    | [OrderApproval](https://docs.partssource.com/documentation/payload-objects#orderapproval)                           |
| [`order.line.backordered`](#orderlinebackordered)                                | A line item is backordered         | [OrderLineBackordered](https://docs.partssource.com/documentation/payload-objects#orderlinebackordered)             |
| [`order.line.nosale`](#orderlinenosale)                                          | A line item was marked as no sale  | [OrderLineNoSale](https://docs.partssource.com/documentation/payload-objects#orderlinenosale)                       |
| [`order.line.estimated_ship_date.created`](#orderlineestimated_ship_datecreated) | An estimated ship date was set     | [OrderLineEstimatedShipDate](https://docs.partssource.com/documentation/payload-objects#orderlineestimatedshipdate) |
| [`order.line.estimated_ship_date.updated`](#orderlineestimated_ship_dateupdated) | An estimated ship date was changed | [OrderLineEstimatedShipDate](https://docs.partssource.com/documentation/payload-objects#orderlineestimatedshipdate) |
| [`order.shipment.shipped`](#ordershipmentshipped)                                | A shipment was dispatched          | [Shipment](https://docs.partssource.com/documentation/payload-objects#shipment)                                     |

***

## Event Details

### `order.created`

Triggered when an order is created.

**Payload:** [Order](https://docs.partssource.com/documentation/payload-objects#order) | **Key fields:** `order_id`, `line_item_id`, `unit_price`, `quantity`

```json
{
  "event_type": "order.created",
  "company_id": 12345,
  "occurred_at": "2024-01-15T10:30:00Z",
  "payload": {
    "order_id": 50001,
    "line_item_id": 100,
    "purchase_order_number": "PO-2024-001",
    "unit_price": 1250.00,
    "quantity": 2
  }
}
```

### `order.approval.submitted`

Triggered when an order approval is submitted.

**Payload:** [OrderApproval](https://docs.partssource.com/documentation/payload-objects#orderapproval) | **Key fields:** `line_item_id`, `approval_type`, `total_amount`

```json
{
  "event_type": "order.approval.submitted",
  "company_id": 12345,
  "occurred_at": "2024-01-15T11:00:00Z",
  "payload": {
    "line_item_id": 100,
    "submitted_at": "2024-01-15T11:00:00Z",
    "approval_type": "manager",
    "total_amount": 2500.00
  }
}
```

### `order.line.backordered`

Triggered when a line item is backordered.

**Payload:** [OrderLineBackordered](https://docs.partssource.com/documentation/payload-objects#orderlinebackordered) | **Key fields:** `line_item_id`, `backorder_reason`

```json
{
  "event_type": "order.line.backordered",
  "company_id": 12345,
  "occurred_at": "2024-01-16T09:00:00Z",
  "payload": {
    "line_item_id": 100,
    "backordered_at": "2024-01-16T09:00:00Z",
    "backorder_reason": "Part unavailable from manufacturer"
  }
}
```

### `order.line.nosale`

Triggered when a line item is marked as no sale.

**Payload:** [OrderLineNoSale](https://docs.partssource.com/documentation/payload-objects#orderlinenosale) | **Key fields:** `line_item_id`, `no_sale_reason`

```json
{
  "event_type": "order.line.nosale",
  "company_id": 12345,
  "occurred_at": "2024-01-16T10:00:00Z",
  "payload": {
    "line_item_id": 100,
    "no_sale_reason": "Part discontinued"
  }
}
```

### `order.line.estimated_ship_date.created`

Triggered when an estimated ship date is first set for a line item.

**Payload:** [OrderLineEstimatedShipDate](https://docs.partssource.com/documentation/payload-objects#orderlineestimatedshipdate) | **Key fields:** `line_item_id`, `estimated_ship_date`

```json
{
  "event_type": "order.line.estimated_ship_date.created",
  "company_id": 12345,
  "occurred_at": "2024-01-15T14:00:00Z",
  "payload": {
    "line_item_id": 100,
    "estimated_ship_date": "2024-01-18T00:00:00Z",
    "reason_description": "Standard processing time"
  }
}
```

### `order.line.estimated_ship_date.updated`

Triggered when an estimated ship date is changed for a line item.

**Payload:** [OrderLineEstimatedShipDate](https://docs.partssource.com/documentation/payload-objects#orderlineestimatedshipdate) | **Key fields:** `line_item_id`, `estimated_ship_date`, `previous_estimated_ship_date`

```json
{
  "event_type": "order.line.estimated_ship_date.updated",
  "company_id": 12345,
  "occurred_at": "2024-01-17T09:00:00Z",
  "payload": {
    "line_item_id": 100,
    "estimated_ship_date": "2024-01-20T00:00:00Z",
    "previous_estimated_ship_date": "2024-01-18T00:00:00Z",
    "reason_description": "Vendor reported shipping delay"
  }
}
```

### `order.shipment.shipped`

Triggered when a shipment is dispatched.

**Payload:** [Shipment](https://docs.partssource.com/documentation/payload-objects#shipment) | **Key fields:** `line_item_id`, `tracking_number`, `carrier`, `estimated_delivery_date`

```json
{
  "event_type": "order.shipment.shipped",
  "company_id": 12345,
  "occurred_at": "2024-01-18T15:30:00Z",
  "payload": {
    "line_item_id": 100,
    "tracking_number": "1Z999AA123456789",
    "carrier": "UPS",
    "shipped_at": "2024-01-18T15:30:00Z",
    "estimated_delivery_date": "2024-01-20"
  }
}
```
