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

# Webhooks

> Configure endpoints and subscriptions to receive signed HTTP notifications when a transaction is broadcast, confirmed, or fails, and when an action completes or fails.

Webhooks push events to a URL you control when something changes on your project, so you can react without polling. Every delivery is a signed HTTP POST, and failed deliveries are retried automatically.

## What triggers a webhook

Two event types are emitted today. Each event's `type` is `resource.action`, and a subscription targets one or more of these combinations.

| Event type | Fires when | Subject fields |
| - | - | - |
| `transaction.status_changed` | A transaction is broadcast, confirms on chain, or fails (at broadcast or on chain) | `transaction_id`, `network`, and `address` when the action has one |
| `position.status_changed` | An action reaches its final `SUCCESS` or `FAILED` status after its transactions are tracked on chain | `position_id` (the action's id), `network`, and `address` when the action has one |

### `transaction.status_changed`

Fires with `data.status` set to `BROADCASTED`, `CONFIRMED`, or `FAILED`. Intermediate statuses such as `CREATED`, `WAITING_FOR_SIGNATURE`, `SIGNED`, and `PENDING` do not emit an event; poll `GET /v1/transactions/{id}` if you need them. The `data` object carries the transaction's `id`, `network`, `status`, `type`, `hash`, `createdAt`, `broadcastedAt`, `error`, and `address` when known. Events raised by a submit (the `BROADCASTED` event, and a `FAILED` event when a submit is rejected) also include `previous.status` and a `changes.status` object with `from` and `to`; events raised by on-chain tracking do not.

### `position.status_changed`

Fires once when an action settles: `data.status` is `SUCCESS` when every transaction confirmed, or `FAILED` when one failed on chain. An action that fails because a submit was rejected does not emit this event; you get only the `transaction.status_changed` `FAILED` event. The `data` object carries `position_id` (the action id you received from the actions endpoints), `status`, `completedAt`, `integrationId` (the yield id), `type` (the action type, for example `STAKE` or `UNSTAKE`), `address`, and `validatorAddress` when the action targets a validator. Other action statuses (`CANCELED`, `STALE`, `PROCESSING`, `WAITING_FOR_NEXT`) do not emit an event.

> [!NOTE]
>
> Only the two event types above are emitted today, and Borrow API transactions do not emit webhook events. If your integration needs a webhook for something else, [contact the Yield.xyz team](mailto:hello@yield.xyz) and we will help get it added.

## Configuration model

Webhooks are configured per project, in that project's dashboard page. Configuration is a dashboard feature: neither the project API key nor the admin API key can create or read it.

* **Endpoint**: a destination URL, a signing secret, and an optional description. A project can have multiple endpoints, and each can be enabled or disabled independently. Use a publicly reachable HTTPS URL. The secret is one you choose, 24 to 255 characters. It is encrypted at rest and is never shown again after you save it, so store it when you create the endpoint; you can replace it later by editing the endpoint. An endpoint cannot be deleted while it still has subscriptions, so delete those first.
* **Subscription**: which resources and actions an endpoint receives, plus optional filters. A subscription lists one or more resources (`transaction`, `position`) and one or more actions (`status_changed`); an event matches when its resource is in the first list and its action is in the second. Each subscription can be enabled or disabled on its own.

### Filters

A subscription's `filtersJson` narrows delivery by the event's subject:

| Filter key | Compared with | Can match today |
| - | - | - |
| `addresses` | `subject.address` | Both event types, when the action has an address |
| `networks` | `subject.network` | Both event types |
| `yield_ids` | `subject.yield_id` | No emitted event carries this field |
| `balance_types` | `subject.balance_type` | No emitted event carries this field |

Every filter key you set must match (AND across keys), and within a key any listed value matches (OR within the list). Values are compared as exact strings, with no case folding or address normalization, so list addresses in the same form your integration passes to the API. An event that lacks the field a filter checks never matches, which means a subscription with `yield_ids` or `balance_types` set receives nothing today. Leave `filtersJson` empty, or leave a key out or as an empty list, to receive every matching event.

```json filtersJson theme={null}
{
  "networks": ["ethereum", "base"],
  "addresses": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e"]
}
```

### Disabling

A disabled subscription matches nothing, so no delivery is created for it. A disabled endpoint still has deliveries created for its enabled subscriptions, but each is marked `dead` with the error `endpoint_disabled` instead of being sent. Events that occur while an endpoint is disabled are not replayed when you enable it again.

### Roles

Creating, updating, or deleting endpoints and subscriptions requires the operator, admin, or owner role; every role, including member, can view configured endpoints, subscriptions, and delivery history. See [Roles and permissions](https://docs.yield.xyz/documentation/advanced-setup/roles-permissions.md).

## Delivery model

When a matching event occurs, it is stored once and queued as one delivery per matching subscription. A dispatcher picks up queued deliveries within a few seconds and sends each as one signed POST to the endpoint URL. The endpoint must respond within 15 seconds; any 2xx response counts as delivered. Timeouts, network errors, and non-2xx responses are retried with increasing backoff:

| After failed attempt | Wait before the next attempt |
| - | - |
| 1 | 5 minutes |
| 2 | 15 minutes |
| 3 | 1 hour |
| 4 | 6 hours |
| 5 to 9 | 24 hours each |

After 10 failed attempts, a delivery is marked `dead` and not retried again. Each delivery's status (`pending`, `sending`, `delivered`, `retry_scheduled`, or `dead`), attempt count, last HTTP status, last error, and last attempt time are visible in the dashboard's delivery history for that endpoint, newest first. You can also open the stored event behind any delivery.

The same status change for the same transaction or action is stored once, even when it is observed more than once. Each event also carries a `sequence` that increases per subject (per transaction or per action), which helps you order deliveries that arrive out of order. The sequence reflects when the event was recorded, not the order of the statuses, so never let a terminal status be overwritten by a non-terminal one; see [Order with sequence](https://docs.yield.xyz/guides/dashboards/webhooks.md#order-with-sequence).

## Test events

A test event is a signed `webhook.test` POST with the same headers and signature as a real delivery. It matches no subscription, is not recorded in the delivery history, and the result is returned directly to whoever sent it. Test sends work on a disabled endpoint, do not follow redirects (a `3xx` response counts as a failed test), and wait 5 seconds for a response. Tell test traffic apart from real events by `type`: a test event has `resource` set to `webhook` and `action` set to `test`.

The dashboard does not have a test button yet. Test sends are available through the dashboard API for a signed-in user with the owner, admin, or operator role; [Send a test event](https://docs.yield.xyz/guides/dashboards/webhooks.md#send-a-test-event) has the route and the response fields. You can also verify an endpoint by triggering an action that produces a matching event and checking the endpoint's delivery history.

## Signature verification

Every request is sent with `Content-Type: application/json` and the headers `X-Yield-Delivery`, `X-Yield-Event` (the resource), `X-Yield-Action`, `X-Yield-Timestamp` (Unix seconds), and `X-Yield-Signature`. The signature is `sha256=` followed by the hex HMAC-SHA256 of the timestamp, a literal `.`, and the raw request body, keyed with the endpoint's secret. Verify it against the raw body before trusting a payload, and reject requests with a stale timestamp to guard against replay. [Receive webhooks](https://docs.yield.xyz/guides/dashboards/webhooks.md) has the verification code.

## Payload

Each event is a JSON object with a unique `id`, `schema_version` (`1`), `resource`, `action`, `type` (`resource.action`), `created_at`, `project_id`, the affected `subject`, a per-subject `sequence`, an `idempotency_key`, and a `data` object with the current state. Some events add `previous` and `changes` (what changed, with `from` and `to`) and `meta` with the emitting source and environment.

The `id` is a UUID that stays the same across retries and across endpoints. [Receive webhooks](https://docs.yield.xyz/guides/dashboards/webhooks.md#payloads) has a full example of each event type.

The same event can be delivered more than once, for example when your endpoint answers 2xx after the 15 second timeout, so deduplicate on the event `id` rather than assuming delivery happens exactly once.

## Where to configure it

Webhooks live in the **Webhooks** table on the project page in the [dashboard](https://dashboard.yield.xyz), below the project's API keys. [Receive webhooks](https://docs.yield.xyz/guides/dashboards/webhooks.md) walks through creating an endpoint and subscription and verifying deliveries.

## Next steps

> [card] [Receive webhooks](https://docs.yield.xyz/guides/dashboards/webhooks.md)
>
> Create an endpoint and subscription, then verify signatures.

> [card] [Actions](https://docs.yield.xyz/documentation/earn/core-concepts/actions.md)
>
> The transaction lifecycle that webhook events report on.

> [card] [Roles and permissions](https://docs.yield.xyz/documentation/advanced-setup/roles-permissions.md)
>
> Who can create and manage webhook endpoints.


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