Register your webhook
Send aPUT request to /api/v1/tenant/webhook with the URL you want Idem to deliver events to. This endpoint both registers a new webhook and replaces an existing one.
The secret is a raw 64-character hex string with no prefix — do not assume a fixed prefix like
whsec_ when parsing or validating it.Retrieve your webhook config
To check which URL is currently registered for your tenant, send aGET request to /api/v1/tenant/webhook. The secret is masked in this response to protect it from accidental exposure.
404 Not Found. Use the PUT endpoint described above to register one.
Verifying webhook signatures
Every request Idem sends to your endpoint includes an HMAC signature in theX-Idem-Signature header, formatted as sha256=<hex-digest>. You must verify this signature before processing the event payload — it confirms the request came from Idem and has not been tampered with in transit.
The general verification flow is:
- Extract the raw request body (as bytes, before any JSON parsing).
- Extract the
X-Idem-Signatureheader value and strip thesha256=prefix. - Compute an HMAC-SHA256 digest of the raw body using your stored webhook secret as the key.
- Compare your computed digest against the signature header value using a constant-time comparison.
- Reject any request where the signatures do not match.
rawBody must be the exact, unparsed request body bytes — if your framework’s body parser (e.g. Express’s express.json()) has already deserialized the payload by the time your handler runs, capture the raw bytes separately (for example, with express.raw({ type: "application/json" }) on the webhook route) before any JSON parsing happens.
Reject and do not process any webhook delivery where signature verification fails.
Update your webhook URL
If you need to rotate your endpoint — for example, after a domain migration or a security rotation — simplyPUT to /api/v1/tenant/webhook again with the new URL:
Required scope
Your API key must have the WEBHOOK_MANAGE scope to call either theGET or PUT endpoints. Only privileged administrative keys should hold this scope to limit who can redirect event delivery.