callbackUrl when creating a run and Leme sends a signed POST to that URL when the run reaches a final state — or pauses for approval.
422 callback_url_invalid.
Events
The payload is intentionally thin — identifiers and status, never the agent’s output:
GET /api/v1/runs/:id. This keeps sensitive content off your webhook endpoint and guarantees you always read the freshest state.
Verify the signature
Every delivery is signed following the Standard Webhooks specification, the same scheme used by OpenAI and Svix. Three headers accompany the request:
First, fetch your project’s signing secret (requires a
read_write token):
Rotate the secret
If the secret leaks — or on your regular rotation schedule — mint a new one:webhook-signature carries two signatures — a delivery is valid if any of them matches, which every Standard Webhooks library handles for you.
Retries and reliability
Deliveries are at least once. If your endpoint does not answer2xx within 15 seconds, Leme retries: after 1 minute, 5 minutes, 30 minutes, and 2 hours. After five failed attempts the delivery is marked exhausted.
Because retries can overlap with your processing, make your handler idempotent — deduplicate on webhook-id.
You can inspect delivery state at any time on the run resource:
Best practices
- Answer fast. Acknowledge with
2xximmediately and process asynchronously; the 15-second timeout includes your handler. - Deduplicate on
webhook-id. Retries reuse the same ID. - Don’t trust the payload alone. Verify the signature, then fetch the run via the API for the authoritative state.
- Watch for
exhausted. If deliveries exhaust, your endpoint was down for hours — poll the runs you have in flight to catch up.