Subscription events
You don’t need these to use subscriptions: entitlements are always current. Events are for work your server does when something changes, such as provisioning a workspace, sending a welcome email, or clearing a cache.
Set up
Section titled “Set up”Under Billing > Webhooks, enter an https URL on your server and save. The
signing secret is shown once; store it as a secret. Send test event sends
a webhook.test event to check the URL.
With the Management API, PATCH /api/v1/billing/settings with
{ "webhookUrl": "..." } returns the secret the first time a URL is set, and
POST /api/v1/billing/settings/webhook-secret rotates it.
The URL must be a public address. Private, loopback and link-local addresses are refused, and redirects are not followed.
Payload
Section titled “Payload”AuthAction sends subscription.updated when a subscription starts, renews,
changes plan, is set to cancel, or ends:
{ "id": "evt_6f1c2a9b0d3e4f5a6b7c8d9e", "type": "subscription.updated", "created": "2026-12-03T10:00:00.000Z", "tenant": "6650c1f2a4b5c6d7e8f90000", "data": { "subscription": { "id": "6650c1f2a4b5c6d7e8f90def", "subjectType": "user", "subjectId": "6650c1f2a4b5c6d7e8f90123", "plan": "6650c1f2a4b5c6d7e8f90abc", "status": "active", "interval": "month", "currentPeriodEnd": "2027-01-03T10:00:00.000Z", "cancelAtPeriodEnd": false }, "entitlements": { "plan": { "key": "pro" }, "features": ["export_pdf"], "limits": { "projects": 50 } } }}data.entitlements has the same shape as the entitlements response.
Treat an event as a prompt rather than a ledger: if events arrive out of order,
the entitlements endpoint still has the current answer.
Verify the signature
Section titled “Verify the signature”Each request carries AuthAction-Signature: t=<unix seconds>,v1=<hex>, an
HMAC-SHA256 with your secret over <t>.<raw body>. Check it against the raw
body, before parsing it, and reject old timestamps.
import { createHmac, timingSafeEqual } from 'node:crypto';
app.post('/hooks/authaction', express.raw({ type: 'application/json' }), (req, res) => { const header = req.header('AuthAction-Signature') ?? ''; const t = /t=(\d+)/.exec(header)?.[1]; const v1 = /v1=([0-9a-f]+)/.exec(header)?.[1]; if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return res.sendStatus(400);
const expected = createHmac('sha256', process.env.AUTHACTION_WEBHOOK_SECRET!) .update(`${t}.${req.body}`) .digest('hex'); if (expected.length !== v1.length || !timingSafeEqual(Buffer.from(expected), Buffer.from(v1))) { return res.sendStatus(400); }
const event = JSON.parse(req.body.toString()); // ... res.sendStatus(200);});import hashlib, hmac, json, os, re, time
def verify(raw_body: bytes, header: str) -> dict: t = re.search(r"t=(\d+)", header).group(1) v1 = re.search(r"v1=([0-9a-f]+)", header).group(1) if abs(time.time() - int(t)) > 300: raise ValueError("stale event") expected = hmac.new( os.environ["AUTHACTION_WEBHOOK_SECRET"].encode(), f"{t}.".encode() + raw_body, hashlib.sha256, ).hexdigest() if not hmac.compare_digest(expected, v1): raise ValueError("bad signature") return json.loads(raw_body)Delivery
Section titled “Delivery”Answer with any 2xx status within 10 seconds. A failed delivery is retried
after 2 seconds, 10 seconds and 1 minute, then dropped. Events may arrive more
than once; use id to skip duplicates.