Webhooks
Send AI results to your backend,signed and retried.
For async requests, ModelRiver posts the result to your webhook URL with an HMAC signature. When a step needs your data, your backend calls back, and ModelRiver carries the result on to the next step or to your users.
How webhooks work
Your app starts the request. Your backend gets the result. Your users see it live.
- 01
Start an async request
Your app calls POST /v1/ai/async and gets a channel ID back right away, before the model has answered.
- 02
Get a signed delivery
When the answer is ready, ModelRiver posts it to each webhook URL in your project, signed with your webhook secret.
- 03
Your backend answers
For a backend pipeline step, your backend reads its own data and posts it to the callback URL within 10 minutes.
- 04
Users see it live
ModelRiver sends the final result to the WebSocket channel your frontend is listening on.
The numbers
- 3Delivery attempts per webhook, with a growing wait between them
- 30 sTime your endpoint has to answer a delivery
- 6Steps you can chain in one backend pipeline
- 10 minTime your backend has to call back, reset at each step
What it looks like
A delivery is a signed JSON envelope. A callback is one authenticated POST.
POST https://your-app.com/webhooks/modelriver
x-modelriver-signature: 3f9a…c21e
x-modelriver-timestamp: 1793600000
x-modelriver-webhook-id: wh_…
{
"channel_id": "550e8400-…",
"timestamp": 1793600000,
"callback_url": "https://api.modelriver.com/v1/callback/550e8400-…",
"data": { "status": "success", "data": { … }, "meta": { … } }
}// Backend pipeline step: add your data, then call back
POST /v1/callback/550e8400-…
Authorization: Bearer mr_live_…
{
"data": { "order_status": "shipped", "eta": "Nov 6" },
"task_id": "order_1234"
}Verify every delivery
Check the HMAC-SHA256 signature with your webhook secret and the timestamp header before you trust a payload.
Resend by hand
Missed one? Resend a delivery from the console or the API within 5 minutes of sending it.
Every attempt logged
Each attempt is stored with its status code, response body, response headers and duration.
Good to know
Async requests only
Sync requests and the OpenAI-compatible endpoint return the answer directly and don’t send webhooks.
HTTPS only
Webhook URLs must use HTTPS. Addresses on private networks are refused, and every send checks the address again.
Late callbacks are refused
If your backend doesn’t call back within 10 minutes, the step times out, your frontend gets a timeout error, and the channel closes.
Each AI step is a request
In a backend pipeline, each AI step counts as its own request on your plan.
Frequently asked questions
Which requests send webhooks?
Async requests to /v1/ai/async. Sync requests and the OpenAI-compatible endpoint return the answer in the response and don’t send webhooks.
How do I verify a webhook?
Each delivery has x-modelriver-signature, x-modelriver-timestamp and x-modelriver-webhook-id headers. Check the HMAC-SHA256 signature with your webhook secret, as shown in the signature docs.
What if my endpoint is down?
ModelRiver tries each delivery up to 3 times, waiting longer between tries. You can also resend a delivery by hand within 5 minutes, and every attempt is logged.
What is a backend pipeline?
A workflow of up to 6 steps where your backend adds its own data between AI steps. ModelRiver sends a webhook with a callback URL and waits up to 10 minutes for your backend to post back.
Can I test webhooks on my laptop?
Yes. The ModelRiver CLI forwards webhook deliveries to a local URL, so you can test against localhost.
Works well with
Wire your backend into an AI workflow
Start on the free plan, add a webhook URL, and send your first async request.