Skip to main content

Format & Signature

Webhooks are HTTP notifications sent from Lago to your application. The messages are sent as a POST to the URL defined in the settings of your Lago workspace.

Message format


"webhook_type": "__TYPE__",
"object_type": "OBJECT_TYPE",
"__OBJECT__": {}


Allong with the payload the message contains a X-Lago-Signature HTTP header.

It is used to ensure the message is Coming from Lago and that the message has not been altered.

To verify the signature, you must decode the signature and compare the result with the body of the webhook.

1. Retrieve the public key

require 'net/http'

api_key = "__YOUR_API_KEY__"
uri = URI('')

http =, uri.port)
http.use_ssl = true

response = http.send_request(
{ 'Authorization' => "Bearer #{api_key}" }

webhooks_public_key = response.body

You should persist the public key on you side to prevent querying it for each webhook

2. Decode and validate the signature

require 'openssl'
require 'jwt'

decoded_signature = JWT.decode(
algorithm: 'RS256',
iss: "",
verify_iss: true,

decoded_signature['data'] == request.body