Skip to main content
The messages are sent as a POST request to every webhook endpoint defined in the settings of your Lago organization. If you return an error (any response other than a 2xx) or if there is a network issue, the message is sent again. Lago attempts each message 3 times, waiting longer between each attempt.

Message format

POST __WEBHOOK_URL__
The object_type field names the key that carries the object. For example, an invoice.created message has "object_type": "invoice" and an invoice key.

Unique key

Lago sends an idempotency key (a unique identifier) in the X-Lago-Unique-Key HTTP header. Use it to process a message only once.

Signature

Along with the payload, the message carries the X-Lago-Signature and X-Lago-Signature-Algorithm HTTP headers. They ensure the message comes from Lago and has not been altered. To verify the signature, decode it and compare the result with the body of the webhook. You choose between two signature algorithms when you create a webhook endpoint, hmac or jwt. The default is jwt.

JWT signature

1. Retrieve the public key


You should persist the public key on your side to avoid querying it for each webhook.

2. Decode and validate the signature

HMAC signature

Decode and validate the signature