# Events

Each webhook request carries one event, as a [CloudEvents 1.0](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md) event in structured JSON mode, with `Content-Type: application/cloudevents+json`. Aryeo sends one event type today.

## The envelope

| Attribute | Holds |
|  --- | --- |
| `specversion` | Always `"1.0"`. |
| `id` | The id of this delivery, equal to the `Idempotency-Key` header. A retry of the same delivery repeats it. Each endpoint receives its own id for one change. |
| `source` | The URL of the Aryeo deployment that sent the event, equal to the `Source` header. |
| `type` | The event type, such as `delivery.created`. |
| `datacontenttype` | Always `application/json`. |
| `time` | When the change happened, in RFC 3339. |
| `data` | The resource after the change, in its `v2` representation. |


## Event types

| Type | Sent when | `data` | Required scope |
|  --- | --- | --- | --- |
| [`delivery.created`](/apis/vendor-platform/openapi#operation/deliveryCreatedWebhook) | Aryeo creates a Delivery. A `POST /deliveries` that returns the Job's existing `undelivered` Delivery sends nothing. | The Delivery | `aryeo.delivery:read` |


`GET /webhook-types` lists the types an endpoint can subscribe to, as [Webhook Types](/apis/vendor-platform/resources/webhook-types) describes. An endpoint receives a type only while the company's approved Version grants its required scope, as [Endpoints and subscriptions](/apis/vendor-platform/guides/webhooks/endpoints-and-subscriptions#which-events-reach-an-endpoint) describes.

## The data

`data` holds the resource itself, with the same fields that the `v2` API returns for it. Its `company_id` names the company the event concerns. The API reference gives the full schema of each type.

## Example

A `delivery.created` request:

```http
POST /aryeo HTTP/1.1
Content-Type: application/cloudevents+json
Idempotency-Key: 5f0c8a3e-2b7d-4c1a-9e6f-3d8b2a1c4e70
Source: https://app.aryeo.com
Timestamp: 1793469852
Signature: 3c9b5f0e1d8a7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e0d9c8b7a6f5e4d3c2b
```

```json
{
  "specversion": "1.0",
  "id": "5f0c8a3e-2b7d-4c1a-9e6f-3d8b2a1c4e70",
  "source": "https://app.aryeo.com",
  "type": "delivery.created",
  "datacontenttype": "application/json",
  "time": "2026-10-30T18:04:12Z",
  "data": {
    "id": "7b2e4f1a-9c3d-4e8b-a6f0-1d5c3b9e2a47",
    "resource_type": "vendor.delivery",
    "company_id": "c1a9e3b7-5d2f-4a6c-8e0b-4f7d2a9c1e53",
    "job_id": "0b6f1c3e-8f4a-4d2b-9a7e-3c5d2e1f4a6b",
    "status": "undelivered",
    "delivered_at": null,
    "created_at": "2026-10-30T18:04:12Z",
    "updated_at": "2026-10-30T18:04:12Z"
  }
}
```

## Handling events

- **Check the signature first,** as [Verifying signatures](/apis/vendor-platform/guides/webhooks/verifying-signatures) describes.
- **Return a 2xx once the event is stored,** and process it afterwards. [Delivery and retries](/apis/vendor-platform/guides/webhooks/delivery-and-retries) says how Aryeo treats each status.
- **Discard an `id` already handled.** A retry repeats the same `id` and `Idempotency-Key`.