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.

83 events covered

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.

Key facts

Signature header
X-Lago-Signature

Also sent: X-Lago-Signature-Algorithm.

Scheme
JWT, RSA, HMAC-SHA256

Two schemes, chosen per endpoint: check which one yours uses.

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.

How events are identified
webhook_type field in the body
Body format
JSON

Content type: application/json.

Other headers
x-lago-signature-algorithm, x-lago-unique-key
Envelope
webhook_type, object_type, organization_id
Agent skill
npx skills add hookdeck/webhook-skills --skill lago-webhooks

Verify Lago webhooks →

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

  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 →
  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 →
  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 →
  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 →

Lago webhook best practices

Common Lago webhook events

Invoices

invoice.created Invoice is finalized
invoice.generated Invoice PDF is ready
invoice.payment_status_updated Payment provider's information changes an invoice's payment status
invoice.payment_failure Invoice payment hits an error, often no valid payment method
invoice.payment_overdue Invoice payment becomes overdue

Subscriptions

subscription.started Subscription starts, including after a plan change
subscription.terminated Subscription ends, including after a plan change
subscription.trial_ended Subscription's free trial ends
subscription.usage_threshold_reached Progressive billing threshold is crossed

Usage and credits

alert.triggered Alert threshold is crossed
wallet.depleted_ongoing_balance Wallet's ongoing balance reaches zero or below
events.errors Hourly health check finds usage events that fail validation

Events by resource

Resource Events Payloads
invoice

invoice.drafted · .ready_to_finalize · .created · .one_off_created +9

13 13
customer

customer.created · .updated · .payment_provider_created · .payment_provider_error +7

11 7
subscription

subscription.incomplete · .started · .updated · .termination_alert +4

8 8
coupon

coupon.created · .updated · .terminated · .deleted

4 4
order_form

order_form.created · .signed · .expired · .voided

4 4
wallet

wallet.created · .updated · .terminated · .depleted_ongoing_balance

4 4
add_on

add_on.created · .updated · .deleted

3 3
billable_metric

billable_metric.created · .updated · .deleted

3 3
credit_note

credit_note.created · .generated · .refund_failure

3 2
feature

feature.created · .updated · .deleted

3 3

5 more resources, including Other Lago events. All 83 events →

In this hub

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

Keep Lago's three attempts from costing you a billing event.

Point an HMAC-signed Lago endpoint at Hookdeck Event Gateway. It verifies the signature, queues each message and retries to your service on your schedule.

Not affiliated with Lago. Facts are compiled from public sources and linked inline.