Webhooks
Optional: once a Manager adds an endpoint, Sheaf POSTs signed ledger rows to your server, with retries.
Set one up
A Manager adds an endpoint in the app under Settings, in Webhooks: a URL and the events to receive. Selecting none receives every event. The signing secret, whsec_…, is shown once. Test sends one signed delivery immediately and shows your server's response.
Sheaf never replays events from before the endpoint existed.
A delivery
{
"id": "whd-8Hq2mZ1xPq0a",
"type": "workflow.auto_filed",
"at": "2026-09-17T21:22:48.377Z",
"application": "euw8ydHxTW",
"data": {
"actor": { "kind": "system", "name": "Workflow", "authenticatedAs": "LOS integration (API)" },
"target": { "type": "run", "id": "run-20260917-212242-ef09" },
"detail": { "workflow": "standard-intake v1", "approved": 1, "matchedToKind": 2, "leftUnassigned": 0, "failed": 0 }
}
}
Each delivery is one ledger row. type is the ledger's own action name.
Events worth subscribing to
| Event | Meaning |
|---|---|
application.created | A case was started. |
file.received | A file landed on a case. |
run.ingested | A run's results landed. |
workflow.auto_filed | A workflow finished filing what it recommended. |
document.approved, document.rejected | A filing decision, by a person or a workflow. |
run.failed | A run failed, or the analyzer went silent for 3 minutes, and the case was put back. |
run.cancelled | The run was stopped (POST /applications/{id}/run/cancel) and the case was put back. |
The full list is the WebhookEvent enum in the contract.
Verify the signature
Deliveries follow the Standard Webhooks specification. Each carries three headers:
| Header | Value |
|---|---|
webhook-id | The delivery id. The same on every retry, so use it to drop duplicates. |
webhook-timestamp | Seconds since the epoch. |
webhook-signature | v1, followed by the base64 HMAC-SHA256 of id.timestamp.body, keyed with your secret. |
The key is the base64 part of the secret, after whsec_. Any Standard Webhooks library verifies the signature for you. Reject a delivery whose signature does not match or whose timestamp is more than a few minutes old.
Without a library, in Node.js, with secret your signing secret, headers the request headers and rawBody the body exactly as received:
import { createHmac, timingSafeEqual } from "node:crypto";
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const signed = `${headers["webhook-id"]}.${headers["webhook-timestamp"]}.${rawBody}`;
const expected = Buffer.from("v1," + createHmac("sha256", key).update(signed).digest("base64"));
const received = Buffer.from(headers["webhook-signature"]);
const valid = received.length === expected.length && timingSafeEqual(received, expected);
Retries
Respond with 2xx within 15 seconds. Otherwise Sheaf retries the delivery 14 times over about 13 hours, from 30 seconds apart up to 2 hours apart, then marks it failed. A 410 response turns the endpoint off; add it again to resume. The endpoint's row in Settings shows its latest delivery.
Sheaf