Appearance
Webhooks
A webhook tells an external system that something in a project changed, so it does not have to poll. The usual consumer is a static-site build, a CDN purge, a search index, or a cache in front of a frontend that reads this API.
Webhooks are configured in the admin UI, not over the API: Project → Webhooks (owner-only, alongside Settings). There is no /api/v1/webhook resource - a subscription is project configuration in the same class as an API token, and handing one out is a governance decision rather than an editing one.
What a delivery looks like
A POST with a JSON body, four identifying headers, and a signature:
http
POST /your/endpoint HTTP/1.1
Content-Type: application/json
User-Agent: Flatnode-CMS-Webhook/1
X-Flatnode-Event: content.promoted
X-Flatnode-Delivery: 2f6c1d9e-5b4a-4f3e-9c21-7a0b8e5d4c3f
X-Flatnode-Attempt: 1
X-Flatnode-Signature: t=1762500000,v1=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
{
"id": "2f6c1d9e-5b4a-4f3e-9c21-7a0b8e5d4c3f",
"event": "content.promoted",
"occurred_at": "2026-11-07T12:34:56+00:00",
"project": { "id": 3, "title": "Schützen Uetterath" },
"data": {
"_uuid": "1efb2c40-...",
"_component": "1efb2c3f-...",
"locale": "en",
"status": "promoted",
"document": "1efb2c3e-..."
}
}id is stable across every retry of the same event - deduplicate on it. An endpoint that answers slowly can be retried while it is still working, so the same id may genuinely arrive twice.
project.id is a numeric project id, not a uuid - projects live outside the content API's uuid-only addressing and have no uuid. Everything inside data is a uuid, as everywhere else.
On a content event, locale says which language changed, as stored: null means the project's default language, and on a project that publishes in only one language it is always null. A translation is a separate version, so promoting one fires its own event rather than re-firing for every language - see Translations.
The payload carries identifiers, not content
data holds uuids and the few scalars needed to decide whether you care (a document's slug, an asset's mime type, a component's published version). It never holds field values.
This is deliberate. Fetching the content yourself keeps version resolution, scheduling windows and per-node permissions in the one place that implements them - so subscribing to content.created does not turn a webhook URL into a feed of unpublished drafts. React to an event by calling the API back for what you need:
content.promoted → GET /api/v1/content/{data._uuid}
or GET /api/v1/document/{data.document}
library.entry_created → GET /api/v1/library/{data.library}/entriesVerifying the signature
X-Flatnode-Signature is t=<unix timestamp>,v1=<hex>, where the hex is HMAC-SHA256(secret, "<t>.<raw request body>"). Sign the raw body as received - re-encoding the JSON first will not match.
Including the timestamp in the signed string is what makes a captured delivery non-replayable: it cannot be re-sent with a fresh t without the secret. Reject anything whose t is far from your own clock (five minutes is a reasonable window).
js
// Node / Express, raw body required
import crypto from 'node:crypto';
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');
// Constant-time: a plain === leaks the digest a byte at a time.
const ok = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return ok && fresh;
}php
// PHP
$parts = [];
parse_str(str_replace(',', '&', $request->header('X-Flatnode-Signature')), $parts);
$expected = hash_hmac('sha256', $parts['t'].'.'.$request->getContent(), $secret);
$ok = hash_equals($expected, $parts['v1'])
&& abs(time() - (int) $parts['t']) < 300;The secret is shown when the endpoint is created and can be looked up again from the Secret button. Rotating it takes effect on the very next delivery, so update the receiver at the same time.
Retries, and when an endpoint gets switched off
A delivery counts as successful on any 2xx. Anything else - another status, a timeout, a refused connection, a TLS failure - is retried: 5 attempts, waiting 10s, 60s, 5min, 15min between them. Acknowledge fast (a bare 204 is fine) and do the real work asynchronously; the request is given 5s to connect and 15s to respond.
Every attempt is logged with its status code, response excerpt and duration, visible per endpoint on the webhook screen and kept for 30 days.
After 10 consecutive deliveries that exhaust all their retries, the endpoint switches itself off and stops receiving events. The screen says so, and re-enabling it also clears the failure count. Nothing is replayed for the period it was off - a disabled endpoint drops events rather than queueing them.
Events
Subscribe to specific events, or to every event - which keeps receiving event types added to the CMS later.
Content
| Event | Fires when |
|---|---|
content.created | New content was created (as a draft). |
content.updated | Content's fields were edited in place. |
content.deleted | Content was hard-deleted, bypassing the version workflow. |
content.version_created | A new version of existing content was started. |
content.submitted | A version was submitted for approval. |
content.approved | A version was approved and is ready to promote. |
content.rejected | A submitted version was rejected. |
content.scheduled | A version's reveal/conceal window was set. |
content.promoted | A version went live. The usual trigger for a rebuild. |
content.withdrawn | A live version was taken back off the site. |
content.discarded | A draft version was discarded. |
data: _uuid (the version), _component, status, document.
Documents
| Event | Fires when |
|---|---|
document.created | A document (page) was created. |
document.updated | A document was renamed, re-slugged, or moved in the tree. |
document.duplicated | A document and its whole subtree were duplicated. |
document.deleted | A document was deleted. |
data: _uuid, title, slug, type, parent. Plus duplicated_from on document.duplicated (the original - _uuid is the clone), and cascaded on document.deleted when the project's root document went, taking every page with it. Deleting a document fires one event for the document, not one per content node that went with it.
Components
| Event | Fires when |
|---|---|
component.created | A component schema was created. |
component.updated | A draft schema or its metadata changed. |
component.version_published | A schema version was published. |
component.deleted | A component schema was deleted. |
data: _component, title, handle, version, publishedVersion. A type generator wants component.version_published specifically - component.updated also fires for unpublished draft saves.
Files
| Event | Fires when |
|---|---|
file.created | An asset was uploaded. |
file.updated | An asset's metadata or variants changed. |
file.deleted | An asset was deleted. |
data: _uuid, title, slug, mime_type, bytesize. No URL - a download URL is only usable with a token (see Files), so resolve one yourself the same way you do elsewhere.
Libraries
| Event | Fires when |
|---|---|
library.created | A library was created. |
library.updated | A library's title or filterable fields changed. |
library.deleted | A library was deleted. |
library.entry_created | An entry was added to a library (as a draft). |
data: library (the library's uuid), title, slug, _component. library.entry_created adds entry: { _uuid, status } - note the entry's uuid is under entry, not _uuid, because the two are different things.
A library entry is ordinary content, so it also produces the content.* events for its own lifecycle - in particular content.promoted when an entry goes live and starts appearing in GET /library/{uuid}/entries.
Test deliveries
The Send test button queues a delivery with event ping and a data.message. It goes to the endpoint whatever that endpoint subscribed to, and shows up in the delivery log with its real status code - the fastest way to confirm URL, TLS and signature verification before waiting for a real change.
Notes
- Only
httpsURLs are accepted. Tunnel anything local. - Events fire per project. A subscription never hears about another project, even one with the same owner.
- Delivery is queued, so an event does not slow down the request that caused it - and a slow endpoint cannot slow down an editor.
- Bulk operations fire per affected resource, except where noted above (a root-document delete). There is no batching or debouncing: a consumer that rebuilds a whole site should debounce on its own side.