Webhooks
Decision, platform and inbound webhooks — signing, retries, delivery, idempotency.
There are three kinds of webhook: decision webhooks the rule itself sends, platform webhooks the platform sends when something happens to a decision (a publish, a deploy, an experiment, a drift alert), and inbound webhooks that let an external system send events to the platform and drive a decision.
Decision webhooks
A decision describes side effects; the runtime performs them. sendWebhook writes to an outbox in
the same transaction as the execution and the worker delivers afterwards. A slow receiver cannot
hold up the caller and an effect is not lost.
Platform webhooks
A project can subscribe to what happens on the platform (Settings → Webhooks, admins only). Subscribable events:
| Event | When it fires |
|---|---|
decision.published | A decision is published. |
decision.deployed | A decision is deployed to an environment. |
publish_request.created | A publish request is created. |
publish_request.approved | A publish request is approved. |
publish_request.rejected | A publish request is rejected. |
experiment.started | An experiment starts. |
experiment.ended | An experiment ends. |
decision.drift_detected | A decision's outcome mix drifted beyond DRIFT_THRESHOLD. |
execution.error_rate_high | More than ALERT_ERROR_RATE of recent executions failed. |
case.created | A case is created. |
case.transitioned | A case moves to another state. |
case.resolved | A case is resolved. |
scheduled_run.completed | A scheduled run finishes. |
scheduled_run.failed | A scheduled run fails. |
webhook.test | Sent by the test button; it is not subscribed to. |
The payload
Every delivery is { id, type, created_at, data }, signed with the webhook's own secret in
x-decision-control-signature: t=<unix>,v1=<HMAC-SHA256("t.body")>. The secret is shown once,
encrypted at rest, and rotates with the credentials key.
Delivery and retries
Retries use the same outbox as decision actions: exponential backoff, dead-lettered after
OUTBOX_MAX_ATTEMPTS. Recording an event never blocks or undoes the change it describes.
Outbound safety
Webhook deliveries are screened like any other outbound call: loopback, private and cloud-metadata
addresses are refused, redirects are not followed, and the resolved address is re-checked. Services
on a private network need OUTBOUND_ALLOWED_HOSTS.
Inbound webhooks
An inbound webhook lets another system (your core backend, a payments provider) push events to
Decision Control. Each event type is routed to a decision, so the sender drives decisions without
writing an integration against /execute. Use it when the system already emits events and you
want a decision to react to them.
Set up a source
Open Settings → Inbound webhooks (admins only) and create a source:
- Name and environment: a route runs what is deployed in this environment (what
latestmeans for an API key). - URL:
POST /api/v1/public/webhooks/<token>. The token is random and shown in the console with a copy button. An unknown or disabled token answers404. - Signature: how the source proves a request is authentic (below). There is no unsigned mode.
The secret is generated for you and shown once, or you can paste the one the sender gave you
(8 to 512 characters; on create, or in the
rotate-secretbody). It is encrypted at rest and can be rotated; the URL token rotates independently. - Event type field (default
type) and default idempotency key (JSONLogic over{ event }, defaultevent.id).
Signature modes
HMAC (default). The sender signs the raw request body with the secret and sends it in a
header (x-lira-signature by default):
x-lira-signature: t=1763288100,v1=5b0e…c9d2v1 is the HMAC-SHA256 of "<t>.<raw body>", t is the Unix time in seconds. A request whose
t is more than the tolerance away from now (300 s by default) is refused (401). The signature
is hex or base64 (your choice) and can carry an optional prefix (for example sha256=). Turn the
timestamp format off to sign the raw body alone. The comparison is constant time.
TOKEN. The sender sends the secret itself in the header, either raw or as
Authorization: Bearer <secret>.
A bad or missing signature answers 401 and nothing is stored.
The event
The body must be a JSON object with an event type. For example:
{
"id": "6f1c2b9e-3a64-4f0e-9d1a-0c7c1f5e8a11",
"type": "TRANSACTION_CREATED",
"event_log_id": 4021,
"occurred_at": "2026-11-16T10:15:00Z",
"resource": { "type": "transaction", "id": "txn_881" },
"data": { "amount": 120, "currency": "USD" }
}Routes
A source has one route per event type: the event type (exact match, or * as the
catch-all), the decision to run and the execution mode. An event with no matching route is stored
as ignored and answered 200, so the sender does not retry something you deliberately skip.
The route's mapping is a JSONLogic expression over { event } that builds the decision input,
for example { "amount": { "var": "event.data.amount" } }. It must return an object. An empty
mapping passes event.data as the input. A route can override the idempotency key
expression; the default is event.id.
Async or sync
- Async (default): the event is stored and answered
202 { "id": "…", "status": "received" }. A worker runs the decision afterwards. - Sync: the decision runs in the request and the answer is
200 { "id": "…", "status": "succeeded", "decision": { … } }. If it takes longer than the route's timeout (5 s by default), the answer is202 { "id": "…", "status": "processing" }; the run is not cancelled, it finishes and stores its result.
| Status | Meaning |
|---|---|
200 | Ignored (no route), processed in sync mode, or a redelivery of a finished event. |
202 | Accepted for async processing, still processing, or sync timed out. |
400 | The body is not a JSON object, has no event type, or contains a NUL character. Nothing is stored. |
401 | The signature or token is missing, malformed, wrong or stale. Nothing is stored. |
404 | Unknown or disabled source token. |
413 | The body is over INBOUND_WEBHOOK_MAX_BODY_BYTES (1 MiB by default). |
422 | The event failed permanently (mapping error, decision not deployed). Retry it from the UI. |
429 | Too many requests from this address (INBOUND_WEBHOOK_REQUESTS_PER_MINUTE). |
500 | A sync run failed with a transient error. The worker retries it until the route's maxAttempts is exhausted, then the event is dead-lettered (failed, retryable by hand from the UI); that request still gets 500. |
Idempotency and redelivery
The idempotency key (default event.id) is unique per source: the same event delivered twice runs
the decision once, whatever the payload of the second delivery. If the key expression returns
null, a SHA-256 of the raw body is used. A redelivery never runs the event again; it is answered
from the stored state:
- finished:
200with the stored decision (orexecution_idwhen no result is stored); - received or processing:
202; - failed permanently:
422with the stored error; - dead-lettered after exhausting its attempts:
202withstatus: "failed". The event is held; only a manual retry from the UI runs it again.
Retries, dead letters and manual retry
If a run fails with a transient error, the event goes back to the queue and the worker retries it
with exponential backoff. attempts counts the runs started. When it reaches the route's
maxAttempts (5 by default), the event is dead-lettered: failed, with no further automatic
retries. Deterministic failures (mapping throws, decision not deployed) are failed at once. A
failed event can be retried by hand from the events log, which resets its attempts.
Test and inspect
On a route, Send test event maps a sample payload and runs the decision as a simulation: no
event is stored, no outbound actions run and nothing counts against idempotency. The simulation
leaves an execution in the executions list. The events log lists
every received event with its status (received, processing, succeeded, failed,
ignored), the decision result, the error and a link to the execution, filterable by status and
type.
Configuration
| Variable | Default | Effect |
|---|---|---|
INBOUND_WEBHOOK_MAX_BODY_BYTES | 1048576 | Largest accepted request body (413 above it). |
INBOUND_WEBHOOK_REQUESTS_PER_MINUTE | 1200 | Per-IP limit on the public endpoint (429). |
Retry backoff uses OUTBOX_BACKOFF_BASE_MS.
The rate limit is per client IP. Behind a reverse proxy or load balancer, set TRUST_PROXY=true
(and TRUST_PROXY_HOPS if more than one proxy sits in front); otherwise every sender behind it
shares one bucket.