# Lago webhooks

Lago webhooks are HTTP POST messages that tell your application when something changes in your Lago billing, such as an invoice being finalized or a subscription starting.

Agent skill: `npx skills add hookdeck/webhook-skills --skill lago-webhooks` ([details](https://hookdeck.com/webhooks/lago/skill))

> Independent reference generated from hookdeck/webhook-registry (commit ff7f882, 20 Nov 2026). [Lago's official docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature).

[Overview](https://hookdeck.com/webhooks/lago) · [Webhook events (83)](https://hookdeck.com/webhooks/lago/events) · [MCP events](https://hookdeck.com/webhooks/lago/mcp-events) · [Verify signatures](https://hookdeck.com/webhooks/lago/verify) · [Production guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts) · [Agent skill](https://hookdeck.com/webhooks/lago/skill)

## Key facts

| Fact | Value | Source |
|---|---|---|
| Signature header | `X-Lago-Signature` Also sent: X-Lago-Signature-Algorithm. | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature) |
| Scheme | `JWT, RSA, HMAC-SHA256` Two schemes, chosen per endpoint: check which one yours uses. | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature) |
| Signed material | `{raw body}` HMAC mode signs the body as sent. In JWT mode the token's data claim carries the body, and you compare it with what you received. | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature) |
| How events are identified | `webhook_type field in the body` | [Lago docs](https://getlago.com/docs/guide/webhooks#accessing-a-specific-event) |
| Body format | `JSON` Content type: application/json. | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature) |
| Other headers | `x-lago-signature-algorithm, x-lago-unique-key` | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature) |
| Envelope | `webhook_type, object_type, organization_id` | [Lago docs](https://getlago.com/docs/api-reference/webhooks/format---signature#signature) |
| Agent skill | `npx skills add hookdeck/webhook-skills --skill lago-webhooks` | [Agent skill →](https://hookdeck.com/webhooks/lago/skill) |

[Verify Lago webhooks](https://hookdeck.com/webhooks/lago/verify)

## How Lago webhooks work

Webhooks push billing changes to your server as they happen, so you don't have to poll the Lago API. An organization can have up to 10 endpoints, each with its own list of message types, and Lago sends a `POST` with a JSON body to every endpoint subscribed to the type.

`webhook_type` says what happened, such as `invoice.created`. `object_type` names the key that holds the object, so that message has an `invoice` key, and the `X-Lago-Unique-Key` header identifies the message. Lago documents no version for its messages, and it adds new types over time.

## Setting up Lago webhooks

- Create an endpoint under Developers > Webhooks in the Lago app, or with `POST /api/v1/webhook_endpoints`, then choose its signature and message types. Lago uses JWT unless you choose HMAC.
- Choose HMAC for an endpoint that points at Hookdeck Event Gateway. To change an existing one, send `PUT /api/v1/webhook_endpoints/{lago_id}` with `signature_algo` set to `hmac`.
- Test locally with the Hookdeck CLI: `hookdeck listen 3000 lago --path /webhooks/lago` gives you a public URL that forwards to your machine.
- Resend a failed message from the webhook logs, under the endpoint's Deliveries tab in Developers > Webhooks.

## Delivery behaviour

- **Timeout:** not published. for Lago Cloud; self-hosted defaults to 30 seconds, set with `LAGO_WEBHOOK_TIMEOUT_SECONDS`. [Guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#timeouts)
- **Retries:** 3 attempts. the first call plus 2 retries, with growing waits; self-hosted sets the total with `LAGO_WEBHOOK_ATTEMPTS`. [Guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#retries)
- **After the last attempt:** error in the logs. you can retry the message from the webhook logs. [Guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#retries)
- **Ordering:** not guaranteed. Lago advises tolerating reordering and fetching current state from the API. [Guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#ordering)

## Known failure modes

1. **Duplicate deliveries.** Lago sends a message again after an error response or a network issue. Record each `X-Lago-Unique-Key` and process each value once. [Handle duplicates](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#duplicates)
2. **Out-of-order delivery.** Lago advises integrations to tolerate reordering. Fetch the object's current state from the API when your next step depends on it. [Handle ordering](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#ordering)
3. **Messages missed after an outage.** Lago makes up to 3 attempts per message, then shows an error in the webhook logs. Retry failed messages from the logs and reconcile against the API after any outage. [Retries and failed messages](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#retries)
4. **HMAC checks fail on a new endpoint.** Lago signs with JWT unless you choose HMAC, so an HMAC check can't match a default endpoint's signature. If `X-Lago-Signature-Algorithm` says `jwt`, change the endpoint or verify the token instead. [Other Lago limits](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#other-limits)

From [Hookdeck's Lago guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts).

## Lago webhook best practices

- **[Verify every signature](https://hookdeck.com/webhooks/lago/verify).** Read `X-Lago-Signature-Algorithm` first, because each endpoint signs with either JWT or HMAC.
- **[Acknowledge fast and queue the work](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#timeouts).** Lago's guide lists `200`, `201`, `202` and `204` as acknowledgements. Store the message, send one of them, then process it in the background.
- **[Deduplicate on the unique key](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#duplicates).** Lago tells you to use `X-Lago-Unique-Key` to process a message only once, so record each value with a unique constraint.
- **[Re-read state before acting](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#ordering).** Lago advises tolerating reordering, and treating its API as the source of truth when a message and your stored state disagree.
- **[Accept types you don't recognize](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#choosing-events).** Lago adds message types over time, so acknowledge an unknown `webhook_type` rather than failing it.
- **[Prefer HMAC where header size matters](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts#other-limits).** JWT carries the payload in the signature header, which can grow large enough for some servers to reject it.

## Common Lago webhook events

### Invoices

- [invoice.created](https://hookdeck.com/webhooks/lago/events#invoice.created): Invoice is finalized
- [invoice.generated](https://hookdeck.com/webhooks/lago/events#invoice.generated): Invoice PDF is ready
- [invoice.payment_status_updated](https://hookdeck.com/webhooks/lago/events#invoice.payment_status_updated): Payment provider's information changes an invoice's payment status
- [invoice.payment_failure](https://hookdeck.com/webhooks/lago/events#invoice.payment_failure): Invoice payment hits an error, often no valid payment method
- [invoice.payment_overdue](https://hookdeck.com/webhooks/lago/events#invoice.payment_overdue): Invoice payment becomes overdue

### Subscriptions

- [subscription.started](https://hookdeck.com/webhooks/lago/events#subscription.started): Subscription starts, including after a plan change
- [subscription.terminated](https://hookdeck.com/webhooks/lago/events#subscription.terminated): Subscription ends, including after a plan change
- [subscription.trial_ended](https://hookdeck.com/webhooks/lago/events#subscription.trial_ended): Subscription's free trial ends
- [subscription.usage_threshold_reached](https://hookdeck.com/webhooks/lago/events#subscription.usage_threshold_reached): Progressive billing threshold is crossed

### Usage and credits

- [alert.triggered](https://hookdeck.com/webhooks/lago/events#alert.triggered): Alert threshold is crossed
- [wallet.depleted_ongoing_balance](https://hookdeck.com/webhooks/lago/events#wallet.depleted_ongoing_balance): Wallet's ongoing balance reaches zero or below
- [events.errors](https://hookdeck.com/webhooks/lago/events#events.errors): Hourly health check finds usage events that fail validation

## Events by resource

| Resource | Events | Payloads |
|---|---|---|
| [invoice](https://hookdeck.com/webhooks/lago/events#resource-invoice) | 13 | 13 |
| [customer](https://hookdeck.com/webhooks/lago/events#resource-customer) | 11 | 7 |
| [subscription](https://hookdeck.com/webhooks/lago/events#resource-subscription) | 8 | 8 |
| [coupon](https://hookdeck.com/webhooks/lago/events#resource-coupon) | 4 | 4 |
| [order_form](https://hookdeck.com/webhooks/lago/events#resource-order-form) | 4 | 4 |
| [wallet](https://hookdeck.com/webhooks/lago/events#resource-wallet) | 4 | 4 |
| [add_on](https://hookdeck.com/webhooks/lago/events#resource-add-on) | 3 | 3 |
| [billable_metric](https://hookdeck.com/webhooks/lago/events#resource-billable-metric) | 3 | 3 |
| [credit_note](https://hookdeck.com/webhooks/lago/events#resource-credit-note) | 3 | 2 |
| [feature](https://hookdeck.com/webhooks/lago/events#resource-feature) | 3 | 3 |

5 more resources. [All 83 events](https://hookdeck.com/webhooks/lago/events)

## In this hub

- [Webhook events](https://hookdeck.com/webhooks/lago/events): Every covered Lago event, with payloads where the registry has them.
- [MCP events](https://hookdeck.com/webhooks/lago/mcp-events): How an agent subscribes to Lago events as MCP events.
- [Verify signatures](https://hookdeck.com/webhooks/lago/verify): Signature facts, verification code and common failures.
- [Production guide](https://hookdeck.com/webhooks/lago/guide-duplicates-ordering-retries-timeouts): Production problems, such as timeouts and retries, and how to handle them.
- [Agent skill](https://hookdeck.com/webhooks/lago/skill): Install the webhook skill in your coding agent. `npx skills add hookdeck/webhook-skills --skill lago-webhooks`
---

Not affiliated with Lago. Facts are compiled from public sources and linked inline. [View as JSON](https://hookdeck.com/webhooks/lago.json) · [Report a correction](https://hookdeck.com/contact)
