API reference
Webhooks
Get a signed message when a Build is done or failed. Verify the HMAC signature in Python or Node, handle retries and repeats.
Instead of polling, send a webhook_url when you create
a Build. When the Build is done or failed, we POST a signed JSON message to that address.
Events#
build.done- The Build is done:
build.reader.url(PDF) orbuild.timings_url(Word List) is set. A PDF Build also hasbuild.reader_data_url. build.failed- The Build failed: see
build.failure_reason.
Each Build with a webhook_url sends exactly one event. Builds made on the website send none.
The message#
A POST with a JSON body. build is the same Build object as
GET /builds/{build_id}.
{
"event": "build.done",
"delivery_id": "0789e430d68e42719d2782d9b19edd2f",
"created_at": "2026-10-11T09:41:12Z",
"build": {
"id": "cd4e2fd751c84d659936cdf0e0002da0",
"url": "https://app.shiurreader.com/api/v1/builds/cd4e2fd751c84d659936cdf0e0002da0",
"title": "Lehavin 6",
"status": "done",
"waiting_reason": null,
"progress": {
"percent": 100,
"message": "Done"
},
"failure_reason": null,
"audio_hours": "1.5",
"visibility": null,
"reader": {
"id": "0dibrutk",
"url": "https://app.shiurreader.com/r/0dibrutk",
"deleted": false
},
"match": {
"words_timed": 958,
"words_total": 1012,
"pages_read": [
5,
6,
7
],
"audio_minutes_matched": 38.4,
"reading_spans": [
[
41.2,
1820.5
],
[
1902.0,
2507.9
]
],
"mismatch": false
},
"timings_url": null,
"reader_data_url": "https://app.shiurreader.com/api/v1/readers/0dibrutk/data",
"created_at": "2026-10-11T09:00:00Z",
"finished_at": "2026-10-11T09:41:12Z"
}
}Headers#
Shiur-Reader-Signaturet=<unix seconds>,v1=<hex signature>. See Verify the signature.Shiur-Reader-Eventbuild.doneorbuild.failed, the same aseventin the body.Shiur-Reader-Delivery- The delivery id, the same as
delivery_idin the body. It stays the same on every retry. Content-Typeapplication/jsonUser-AgentShiurReader-Webhooks/1
Verify the signature#
Anyone can POST to your address, so check every message before you trust it. Your Organization's signing
secret (whsec_...) is on the API Keys page, for Owners.
- Read
tandv1from theShiur-Reader-Signatureheader. - Compute HMAC-SHA256 with the secret as key over
t, a dot, and the raw request body (the exact bytes, before any JSON parsing), as lowercase hex. - Compare it with
v1in constant time. - Reject the message if
tis more than 300 seconds (5 minutes) from your clock. This stops replays of old messages.
signature = hex(HMAC_SHA256(secret, t + "." + raw_body))Python
import hashlib
import hmac
import os
import time
SECRET = os.environ["SHIUR_READER_WEBHOOK_SECRET"] # whsec_..., from the API Keys page
TOLERANCE = 300 # seconds
def verify(raw_body: bytes, signature_header: str) -> bool:
"""True if the Shiur-Reader-Signature header matches the raw request body."""
parts = dict(item.split("=", 1) for item in signature_header.split(",") if "=" in item)
timestamp, received = parts.get("t", ""), parts.get("v1", "")
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > TOLERANCE:
return False
expected = hmac.new(SECRET.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, received)
# Flask
from flask import Flask, abort, request
app = Flask(__name__)
seen = set() # use your database in production
@app.post("/hooks/shiur-reader")
def shiur_reader_webhook():
if not verify(request.get_data(), request.headers.get("Shiur-Reader-Signature", "")):
abort(400)
delivery_id = request.headers["Shiur-Reader-Delivery"]
if delivery_id not in seen: # a retry repeats the same delivery id
seen.add(delivery_id)
message = request.get_json()
build = message["build"]
if message["event"] == "build.done":
print("Ready:", build["reader"]["url"] if build["reader"] else build["timings_url"])
else:
print("Failed:", build["failure_reason"])
return "", 204JavaScript
import crypto from "node:crypto";
import express from "express";
const SECRET = process.env.SHIUR_READER_WEBHOOK_SECRET; // whsec_..., from the API Keys page
const TOLERANCE = 300; // seconds
function verify(rawBody, signatureHeader = "") {
const parts = Object.fromEntries(
signatureHeader.split(",").map((item) => item.split(/=(.*)/s).slice(0, 2)),
);
const timestamp = Number(parts.t);
if (!Number.isInteger(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > TOLERANCE) return false;
const expected = crypto
.createHmac("sha256", SECRET)
.update(`${parts.t}.`)
.update(rawBody)
.digest("hex");
const received = Buffer.from(parts.v1 ?? "", "utf8");
return received.length === expected.length && crypto.timingSafeEqual(Buffer.from(expected, "utf8"), received);
}
const app = express();
const seen = new Set(); // use your database in production
// express.raw keeps the exact bytes that were signed.
app.post("/hooks/shiur-reader", express.raw({ type: "application/json" }), (req, res) => {
if (!verify(req.body, req.get("Shiur-Reader-Signature"))) return res.sendStatus(400);
const deliveryId = req.get("Shiur-Reader-Delivery");
if (!seen.has(deliveryId)) { // a retry repeats the same delivery id
seen.add(deliveryId);
const { event, build } = JSON.parse(req.body);
if (event === "build.done") console.log("Ready:", build.reader?.url ?? build.timings_url);
else console.log("Failed:", build.failure_reason);
}
res.sendStatus(204);
});
app.listen(3000);Every attempt, retries included, is signed afresh with the current time and the current secret.
Respond, and retries#
Answer with any 2xx status within 10 seconds. Do slow work after answering. Anything else (an error
status, a redirect, a timeout, no connection) is a failed attempt, and we try again after:
- 1 minute
- 5 minutes
- 30 minutes
- 2 hours
- 8 hours
That is 6 attempts over about 10.5 hours. After the last one fails we give up; the Build itself is not affected, and you can still get it. Redirects are never followed, so give the final address.
Repeats and order#
A message can arrive more than once, for example if your server handled it but the answer was lost. A retry
carries the same Shiur-Reader-Delivery id, so store the ids you have handled and ignore repeats, as in
the examples above.
Webhook addresses#
- The address must be a public
https://(orhttp://) URL of at most 2000 characters. Private and local addresses (localhost,10.x,192.168.x, ...) are refused with400 invalid_webhook_url, and checked again before every attempt. - Use https, so the message (which includes the Reader link) is encrypted in transit.
- To test on your own computer, expose it with a tunnel (for example ngrok or Cloudflare Tunnel) and use the tunnel's public address.
Rotate the secret#
On the API Keys page, an Owner can select Rotate secret. The old secret stops working at once, also for retries still pending, so update your server right after rotating.