Help centerDevelopers
Webhooks
Get a signed notification in your system when a domain is added, changes status or is removed, with automatic retries and redelivery.
Instead of asking the API every minute whether a customer's domain is live yet, register a webhook: Tenanci sends a
JSON POST to your URL as soon as something happens. Every delivery is signed with a secret only you know, so your
system can tell the notification really came from Tenanci.
Create a webhook
Owners and admins manage webhooks (members don't see this tab).
- Open Organization → Webhooks.
- Click New webhook.
- Under URL (https), paste the address in your system that will receive the notifications.
- Optionally fill in Description (optional) (e.g. "Production backend").
- Under Events, tick what you care about. Domain changed status comes ticked.
- Click Create webhook.
- Copy the Signing secret (it starts with
whsec_) and store it with your system's environment variables. It won't be shown again.
The URL must be https, on the default port (443), with no username/password, and point to a public address:
internal addresses (localhost, private networks) are rejected. You can have up to 10 webhooks per
organization.
Events
| In the dashboard | Event | When |
|---|---|---|
| Domain added | domain.created |
a domain was registered (dashboard, API, MCP or the customer portal) |
| Domain changed status | domain.status_changed |
the status changed: went live, failed, was turned off, was suspended… |
| Domain removed | domain.deleted |
the domain was removed |
| TailorKit published | tailorkit.published |
a new TailorKit version went live (editor, schedule, rollback or customer portal) |
| — | test.ping |
you clicked Send test |
A domain's possible statuses are pending_dns, verifying, issuing_cert, active, suspended, error and
removed (see domains).
What your system receives
A POST with Content-Type: application/json and these headers:
| Header | Content |
|---|---|
Tenanci-Event |
the event, e.g. domain.status_changed |
Tenanci-Delivery |
the delivery id (dlv_…), the same across all its attempts |
Tenanci-Signature |
t=<unix>,v1=<signature> (see below) |
User-Agent |
Tenanci-Webhooks/1.0 |
The body of a domain event:
{
"id": "dlv_7Kq2xP9mW3",
"event": "domain.status_changed",
"createdAt": "2026-10-22T14:03:11.402Z",
"data": {
"domain": { "id": "dom_4h7n1q", "hostname": "joesbarbershop.com", "projectId": "prj_8f3k2m" },
"from": "issuing_cert",
"to": "active",
"reason": "cert_issued",
"at": "2026-10-22T14:03:10.977Z"
}
}from/to: the status before and after (fromisnullondomain.created;toisremovedondomain.deleted);reason: the technical reason (e.g.cert_issued,dns_timeout,user_disabled). Branch onto;reasonis for logs and messages;at: when the change happened.
For tailorkit.published, data carries domain (id, hostname, projectId), version (the live version
number), source (editor, or direct when it came from the customer portal) and at.
For test.ping, data only carries { "message": "Teste do webhook da Tenanci" }.
Verify the signature
The Tenanci-Signature header looks like t=1761141791,v1=5f2b…, where v1 is the hex HMAC-SHA256 of
"<t>.<body>", keyed with the webhook secret (the whole string, whsec_ included). To verify:
- take the raw body, exactly as received (before any
JSON.parse); - compute the HMAC of
`${t}.${body}`with the secret; - compare it to
v1using a constant-time comparison; - reject it if
tis too far from the current time (e.g. more than 5 minutes), to block old replays.
import express from "express";
import { createHmac, timingSafeEqual } from "node:crypto";
function verifyTenanci(rawBody, header, secret, toleranceSec = 300) {
const parts = Object.fromEntries(
(header ?? "").split(",").map((p) => {
const i = p.indexOf("=");
return [p.slice(0, i).trim(), p.slice(i + 1).trim()];
}),
);
const t = Number(parts.t);
if (!t || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = Buffer.from(createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"), "hex");
const received = Buffer.from(parts.v1, "hex");
return expected.length === received.length && timingSafeEqual(expected, received);
}
const app = express();
// raw body: the signature covers the exact bytes we sent
app.post("/webhooks/tenanci", express.raw({ type: "application/json" }), (req, res) => {
const raw = req.body.toString("utf8");
if (!verifyTenanci(raw, req.get("Tenanci-Signature"), process.env.TENANCI_WEBHOOK_SECRET)) {
return res.status(400).send("invalid signature");
}
const evt = JSON.parse(raw);
res.sendStatus(200); // answer fast; do the work afterwards (queue, job)
if (evt.event === "domain.status_changed" && evt.data.to === "active") {
// mark the customer's domain as live in your system
}
});// app/api/webhooks/tenanci/route.ts — reuse verifyTenanci from above
export async function POST(req: Request) {
const raw = await req.text();
if (!verifyTenanci(raw, req.headers.get("tenanci-signature"), process.env.TENANCI_WEBHOOK_SECRET!)) {
return new Response("invalid signature", { status: 400 });
}
const evt = JSON.parse(raw) as { event: string; data: { domain?: { id: string }; to?: string } };
// ...
return new Response(null, { status: 200 });
}Retries and redelivery
A delivery succeeds when your system answers 2xx within 10 seconds. Anything else (error, timeout, a 3xx
redirect, 4xx, 5xx) counts as a failure and Tenanci retries on its own, with growing intervals, up to
6 attempts in total. After that, the delivery is marked Failed.
To inspect and redeliver:
- On the webhook's row, click Deliveries (the 50 most recent show up, with status, event, attempts and the error, if any).
- On a Failed delivery, click Redeliver.
Redelivery creates a new delivery (a different id and Tenanci-Delivery) with the same event and data.
Turn on/off, rotate the secret and remove
- Active (the switch on the row): when off, events aren't sent to that webhook.
- Generate new secret: the current secret stops working right away. Have the new one ready to put into your system before you confirm.
- Remove: deletes the webhook; it stops receiving events.
Webhooks are managed from the dashboard only: API keys can't create or change them. Every change is recorded in the organization activity.

