Skip to content

Webhooks

Webhooks let your server receive an HTTP POST when something happens in your Lizen account — no polling required.

Available on Hobby tier and above.

Payload envelope

All webhook payloads follow the same structure:

{
"id": "evt_01j9abc123",
"type": "key.revoked",
"created_at": "2026-08-16T12:00:00Z",
"account_id": "acc_xyz789",
"data": {
"id": "lic_abc123",
"key_prefix": "MYAPP-ABCD",
"product_id": "prod_def456",
"status": "revoked"
}
}

Verifying signatures

Every webhook request includes an X-Lizen-Signature header — an HMAC-SHA256 hex digest of the raw request body, signed with your webhook’s secret.

import { createHmac } from 'crypto';
function verifyWebhook(body: string, signature: string, secret: string): boolean {
const expected = createHmac('sha256', secret)
.update(body, 'utf8')
.digest('hex');
return timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

Delivery and retries

Lizen delivers webhooks asynchronously via Cloudflare Queues. Delivery is attempted up to 6 times with exponential backoff:

AttemptDelay
1Immediate
25 seconds
330 seconds
42 minutes
510 minutes
630 minutes

A delivery is considered successful when your server returns any 2xx status. After 6 failed attempts, the event is dropped and logged.

Best practices

  • Respond with 200 immediately, then process the event asynchronously. If your handler is slow, webhooks will time out.
  • Use the id field for idempotency — the same event may be delivered more than once on retries.
  • Check created_at to handle events that arrive out of order.
  • Store the webhook secret in an environment variable, never in source code.

Event types

EventWhen it fires
key.createdA new license key is generated
key.revokedA license key is revoked
key.expiredA license key’s expiry passes (daily cron)
key.extendedA license key’s expiry is extended
activation.createdA new device activates a license
activation.deactivatedA device activation is removed
product.createdA new product is created
account.plan_changedThe account plan changes