How it works
- Each league has at most one webhook, set up by its owner in League settings → Webhook.
- When you turn a webhook on, or point it at a new URL, it first receives a full copy: every dataset for every season the league has saved.
- After that, each time the tracker saves new data, the changed datasets arrive within about a minute.
- Each POST carries one dataset for one season. A season document (schedule, rankings, postseason, recruiting, coaches, awards) is always complete. Box scores arrive up to 20 games at a time, and rosters up to five schools from one roster capture.
- Up to ten deliveries go out per league each minute, so a large league’s first full copy can take several minutes.
Set up
- Run a receiver at a public
https://URL on the standard port (443). For local development, use a tunnel such as Cloudflare Tunnel or ngrok. - Open your league’s Settings, find Webhook, enter the URL and save.
- Copy the signing secret (
whsec_…) into your receiver’s configuration. You can reveal or rotate it later. - Press Send test delivery and check that your receiver answered
2xx.
Delivery format
Each delivery is a POST with a JSON body:
{
"id": "0f8e8a3e-5d3b-4c55-9f0e-6f0f6b1a2c3d",
"type": "dataset.updated",
"createdAt": 1793000000000,
"test": false,
"league": {"id": "cfb27-815166", "name": "TeamCrafters", "url": "https://dynastyrewired.com/leagues/cfb27-815166"},
"dataset": "schedule",
"season": 2028,
"data": { … exactly what GET /leagues/cfb27-815166/seasons/2028/schedule returns … }
}| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | DynastyRewired-Webhooks/1.0 |
X-DR-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256>, described below |
X-DR-Event | dataset.updated |
X-DR-Dataset | The dataset name, such as schedule |
X-DR-Delivery | A unique ID for this attempt |
X-DR-Test | true on test deliveries only |
dataset | data |
|---|---|
schedule | The season’s schedule document |
rankings | The season’s rankings document |
postseason | The season’s postseason document |
recruiting | The season’s recruiting document |
coaches | The season’s coaches document |
awards | The season’s awards document |
box-scores | {"games": [box score, …]}, up to 20 box scores |
rosters | {"runId": "…", "schools": [school roster, …]}, up to five school rosters from one capture |
Verify the signature
Compute an HMAC-SHA256 of <t>.<raw body> with your signing secret (the whole whsec_… string) and compare it, in constant time, with the hex v1 value. Use the raw request bytes: parsing and re-serializing the JSON changes them. Reject a timestamp more than five minutes old.
import crypto from "node:crypto";
export function verifyDynastyRewired(rawBody, signatureHeader, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(signatureHeader.split(",").map(part => part.split("=")));
const timestamp = Number(parts.t);
if (!Number.isInteger(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest();
const given = Buffer.from(parts.v1 ?? "", "hex");
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
// Express: keep the raw body for verification.
app.post("/dynasty-rewired", express.raw({type: "application/json", limit: "25mb"}), (req, res) => {
if (!verifyDynastyRewired(req.body.toString("utf8"), req.get("X-DR-Signature") ?? "", process.env.DR_WEBHOOK_SECRET))
return res.sendStatus(401);
res.sendStatus(200);
const delivery = JSON.parse(req.body);
// Save delivery.data for delivery.league.id, delivery.dataset and delivery.season.
});import hashlib, hmac, time
def verify_dynasty_rewired(raw_body: bytes, signature_header: str, secret: str, tolerance: int = 300) -> bool:
parts = dict(part.split("=", 1) for part in signature_header.split(",") if "=" in part)
try:
timestamp = int(parts["t"])
except (KeyError, ValueError):
return False
if abs(time.time() - timestamp) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Responses, retries and duplicates
- Answer with any
2xxstatus within 10 seconds. Store the body and do slow work afterwards. - Anything else is a failure: another status, a timeout, a connection error or a redirect. Redirects are not followed, so use the final URL.
- After a failure, delivery for that league pauses and retries 30 seconds later, doubling up to once an hour. Nothing is skipped: the undelivered data is sent when your server recovers.
- After 10 failures in a row, the league owner and every league manager get a notice on Dynasty Rewired and an email. The next delivery your server accepts clears it.
- After 50 failures in a row, the webhook turns itself off, and they hear about that too. Turn it on again in League settings to receive a fresh full copy.
- Delivery is at least once, and order between datasets is not guaranteed. Save by key and overwrite: season documents by league, dataset and season; box scores by
gameId; rosters byrunIdandteam.teamId. - A newer delivery of the same season document replaces the older one completely.
Test deliveries
Send test delivery in League settings, or POST /leagues/{league}/webhook/test with your token, sends a static sample: a real schedule document from the public TeamCrafters league. It has "test": true, the header X-DR-Test: true and your secret’s signature. Download the exact bytes from webhook-sample.json.
To test locally without a tunnel, replay the sample yourself with a valid signature:
// replay-sample.mjs: node replay-sample.mjs http://localhost:3000/dynasty-rewired
import crypto from "node:crypto";
const body = await (await fetch("https://dynastyrewired.com/developer/webhook-sample.json")).text();
const t = Math.floor(Date.now() / 1000);
const v1 = crypto.createHmac("sha256", process.env.DR_WEBHOOK_SECRET).update(`${t}.${body}`).digest("hex");
const response = await fetch(process.argv[2], {method: "POST", body, headers: {
"Content-Type": "application/json", "X-DR-Signature": `t=${t},v1=${v1}`,
"X-DR-Event": "dataset.updated", "X-DR-Dataset": "schedule", "X-DR-Test": "true", "X-DR-Delivery": crypto.randomUUID()}});
console.log(response.status);Requirements and limits
- The URL must use
https://on port 443 with a public host name: no IP addresses, local names or credentials in the URL, and never a Dynasty Rewired address. - Accept bodies of at least 25 MB. Most deliveries are far smaller, but a season’s recruiting pool or a batch of rosters can reach several megabytes.
- Webhooks work during a league’s free trial. When the trial ends without a subscription, deliveries pause, and they resume (including everything missed) once the owner subscribes.
- Anyone with your signing secret can forge deliveries. Rotate it in League settings if it leaks; deliveries after the rotation use the new secret.
