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

# Webhooks and the event feed

> Receive signed Elastly events at your HTTPS endpoint, verify each signature, handle retries and replays, and read the same events from the event feed.

Elastly records an event when something your systems may need to act on happens, such as a price change, a quote outcome or a finished sync. You can receive every event as a signed `POST` to your own endpoint, read the same events from the event feed, or both. This page covers setting up the endpoint, the event types and payload, signature verification, delivery and retries, and the event feed.

## Who can set up webhooks

Turning webhooks on, setting the endpoint, rotating the secret and sending a test event need **Edit** access to the **API & webhooks** area. See [Roles](/docs/administration/roles.md).

## Set up an endpoint

**1. Open the webhooks card**

Go to **Manage** > **API & webhooks**. The **Webhooks** card is at the bottom of the page.

**2. Turn webhooks on**

Switch on **Webhooks**.

**3. Enter the endpoint**

Enter the **Endpoint URL** and press Enter. The address must be a public `https://` address on port 443 with a host name. Private and internal addresses and IP addresses are refused.

**4. Copy the signing secret**

Reveal the **Signing secret** and copy it to your endpoint's configuration. It starts with `whsec_`.

**5. Send a test event**

Select **Send test event**. Elastly posts a sample `price.changed` event and shows the result on the card. Test events are never retried or replayed.

The endpoint receives every event type. To stop deliveries for a while, switch off **Webhooks** and confirm with **Pause**.

## Event types

| Event | Sent when |
| - | - |
| `price.changed` | A custom price is set or ended, or a price is rolled back |
| `quote.created` | A quote is created |
| `quote.pushed` | A quote is sent to the provider |
| `quote.push_failed` | Sending a quote to the provider failed |
| `quote.outcome` | A quote outcome is recorded, including outcomes reported through the API |
| `approval.requested` | An approval is requested |
| `approval.decided` | An approval is decided |
| `policy.published` | A pricing policy is published |
| `strategy.activated` | A strategy is activated |
| `recommendation.created` | A recommendation is created |
| `recommendation.accepted` | A recommendation is accepted |
| `recompute.completed` | A price recompute completed |
| `recompute.blocked` | A price recompute was blocked |
| `sync.completed` | A sync with a provider completed |
| `sync.failed` | A sync failed, or the provider's credentials expired |
| `writeback.ready` | Approved prices are ready for write-back |
| `writeback.confirmed` | A write-back was confirmed by the provider |
| `writeback.failed` | A write-back failed |
| `usage.threshold` | The workspace crossed a usage threshold |
| `import.completed` | A data import completed |
| `channel.published` | A price list version went live on a channel and its price changes are ready to read |

## Payload

Every event has the same shape. `data.object` names the record the event is about; some events add `sku`, `connection_id`, `kind` or `state`.

```json theme={null}
{
  "id": "4f8a2c61-9d3e-4b07-a5c2-1e7f9b3d6a80",
  "type": "sync.completed",
  "timestamp": "2026-11-02T09:30:00.000Z",
  "data": {
    "workspace_id": "0c7e3a19-6f2d-4b84-9a51-d2e8c4f7b136",
    "object": {
      "type": "sync_run",
      "id": "a3d91f47-2b6c-4e08-8f15-6c0e7b2d9a44",
      "version": null,
      "connection_id": "e5b72c08-4d1f-4a96-b3e7-0f9c8d2a6b51",
      "kind": "incremental"
    },
    "payload_version": 1,
    "livemode": true
  }
}
```

The payload names what changed. Read the current state through the API or the dashboard.

## Verify the signature

Every delivery carries these headers.

| Header | Value |
| - | - |
| `webhook-id` | The event `id`. The same on every retry and replay |
| `webhook-timestamp` | When this attempt was sent, in Unix seconds |
| `webhook-signature` | One or more signatures, separated by spaces, each in the form `v1,<signature>` |
| `Elastly-Version` | The API version of the endpoint |

The TypeScript client verifies a delivery for you with `verifyWebhook`. See [Client libraries](/docs/developers/client-libraries.md#verify-a-webhook). To verify a delivery yourself:

1. Join the `webhook-id`, the `webhook-timestamp` and the raw request body with a period: `id.timestamp.body`.
2. Remove the `whsec_` prefix from the signing secret and decode the rest from base64.
3. Compute an HMAC-SHA256 of the joined string with the decoded secret and encode it in base64.
4. Accept the delivery if any `v1` signature in the header matches, using a constant-time comparison.

Use the raw body exactly as received. Parsing and re-encoding the JSON changes it and breaks the signature. Reject a delivery whose timestamp is far from your current time, for example more than five minutes, to block replayed requests.

```typescript TypeScript theme={null}
import { createHmac, timingSafeEqual } from "node:crypto"

export function verifyElastlyWebhook(
  secret: string,
  headers: { id: string; timestamp: string; signature: string },
  rawBody: string,
) {
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64")
  const expected = createHmac("sha256", key)
    .update(`${headers.id}.${headers.timestamp}.${rawBody}`)
    .digest()
  const ageSeconds = Math.abs(Date.now() / 1000 - Number(headers.timestamp))
  if (!Number.isFinite(ageSeconds) || ageSeconds > 300) return false
  return headers.signature.split(" ").some((entry) => {
    const [version, value] = entry.split(",")
    if (version !== "v1" || !value) return false
    const received = Buffer.from(value, "base64")
    return received.length === expected.length && timingSafeEqual(received, expected)
  })
}
```

```python Python theme={null}
import base64
import hashlib
import hmac
import time


def verify_elastly_webhook(secret: str, msg_id: str, timestamp: str, signature: str, raw_body: bytes) -> bool:
    if abs(time.time() - int(timestamp)) > 300:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f"{msg_id}.{timestamp}.".encode() + raw_body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
    for entry in signature.split(" "):
        version, _, value = entry.partition(",")
        if version == "v1" and hmac.compare_digest(value, expected):
            return True
    return False
```

The scheme follows the Standard Webhooks specification, so a Standard Webhooks library can verify deliveries too.

## Rotate the signing secret

Select **Rotate** next to **Signing secret**, then **Rotate secret**. The previous secret keeps signing for 24 hours, so each delivery in that window carries two signatures. Update your endpoint within 24 hours.

## Delivery and retries

* Respond with any `2xx` status to acknowledge a delivery. Respond quickly and do the work afterwards; an attempt that takes longer than 15 seconds counts as failed.
* Delivery is at least once and in no guaranteed order. Use `webhook-id` to ignore an event you already handled.
* A failed attempt is retried up to 9 more times, from 5 seconds to 24 hours apart. For `429`, `502` and `503` responses, a `Retry-After` header of up to 24 hours is honoured.
* A `410` response stops deliveries to the endpoint at once.
* After 5 days of failed deliveries, deliveries stop. Fix the endpoint and switch **Webhooks** on again.

> [!WARNING]
>
> When deliveries stop after a `410` or 5 days of failures, events that occur meanwhile are not posted. Read them from the event feed to catch up.

## Delivery log

Select **Delivery log** on the **Webhooks** card to see every attempt with its **Event**, **Status**, **Attempt**, **Response** and **Sent** time.

| Status | Meaning |
| - | - |
| **Delivered** | The endpoint answered `2xx` |
| **Retrying** | Another attempt is scheduled |
| **Failed** | Every attempt was used or the endpoint answered `410` |
| **Test** | A test event |

Select **Replay** on a delivery to post the same event again with its original `id`. Replay is available for 15 days after sending.

## Read the event feed

`GET /v1/events` returns the same events, oldest first, in the payload shape above. Any **Live**, **Test** or **Read-only** key can read it; a live key reads live events and a test key reads test events. Filter with `type` and follow it with the `after` cursor. See [Pagination](/docs/developers/pagination.md).

```bash theme={null}
curl "https://api.elastly.ai/v1/events?type=price.changed&type=quote.outcome&limit=100" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Store the `nextCursor` of each page and send it as `after` on your next request to read only newer events.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.