Webhooks
Create a watch with an HTTPS URL and we POST a signed JSON event when something changes. Respond with any 2xx status within 8 seconds.
Events
| Event | When |
|---|---|
vehicle.mot_due, vehicle.tax_due | The days remaining reach each of your daysBefore values (default 30, 7 and 1) |
vehicle.mot_expired, vehicle.tax_expired | The first daily check after expiry |
vehicle.mot_test_recorded | A new MOT test appears |
company.status_changed | Companies House status changes |
company.accounts_overdue, company.confirmation_statement_overdue | A filing becomes overdue |
company.risk_changed | The overall risk level changes |
company.insolvency_notice | The Gazette publishes a corporate insolvency notice for the company |
company.filing | Companies House records a new filing |
company.charge_created, company.charge_satisfied | A charge is registered or satisfied |
company.insolvency_case | An insolvency case is opened or updated |
sanctions.match_added, sanctions.match_removed | A monitored name gains or loses a potential match after a list update |
Creating a watch
Send one of registration, companyNumber or sanctions (a name to monitor) with a url. List with GET /v1/watches and remove with DELETE /v1/watches/{id}. Add many companies at once with POST /v1/watches/bulk.
curl https://api.tychelabs.net/v1/watches \
-H "x-api-key: $TYCHE_API_KEY" \
-H "content-type: application/json" \
-d '{"registration":"AB12CDE","url":"https://example.com/hooks/tyche","daysBefore":[30,7,1]}'import crypto from "node:crypto";
// header looks like: t=1763542800,v1=5d41402abc4b2a76b9719d911017c592...
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}import hashlib, hmac, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
signed = f"{parts['t']}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
fresh = abs(time.time() - int(parts["t"])) < 300
return fresh and hmac.compare_digest(expected, parts["v1"])Verifying signatures
The tyche-signature header is t=<unix time>,v1=<hex HMAC-SHA256 of "t.body"> using your webhook secret. Reject events older than five minutes. The verify tabs above show Node and Python.
Test events
POST /v1/watches/test-event with {"url": "https://…", "type": "company.insolvency_notice"} sends a signed sample, even with a sandbox key.
Email digests
Company and sanctions watches can also send a daily email digest to your account email: set "emailDigest": true when you create the watch. A digest only goes out on days with events.