AgentRail signs each webhook delivery with an HMAC signature. Before you process any payload, verify that signature against the raw request body and your webhook secret. TheDocumentation Index
Fetch the complete documentation index at: https://agentrail.app/docs/llms.txt
Use this file to discover all available pages before exploring further.
parse_webhook_event function handles verification and deserialization in one call.
Import
Verify and parse a delivery
parse_webhook_event raises an exception if the signature does not match or if the body cannot be deserialized.
Parameters
| Parameter | Type | Description |
|---|---|---|
raw_body | bytes | str | The raw request body, unmodified |
| Second argument | str | Your webhook secret from AGENTRAIL_WEBHOOK_SECRET |
signature | str | The value of the X-AgentRail-Signature header |
Use the raw request body
In FastAPI, read the raw body withRequest.body():
request.body before any JSON parsing middleware runs.
Set the webhook secret
Your webhook secret (AGENTRAIL_WEBHOOK_SECRET) is separate from your API key. You set it when you create a webhook subscription — see POST /event-subscriptions for the secret parameter..png?fit=max&auto=format&n=TNCV8lxzL1ij3U4N&q=85&s=7345b71aa1c450c74f35b67c2655fc43)