Receive webhooks
Get notified when a document is generated or a template is published, without polling the API.
Rather than polling Mizanpage, declare an endpoint, a URL on your server. Mizanpage sends it a signed POST for each event.
Events
| Event | When |
|---|---|
document.generated |
A counted document has just been generated by POST /v1/render. Once per document |
render.completed |
A PDF requested with POST /v1/renders is ready. data.download_url opens it for one hour |
render.failed |
A PDF requested with POST /v1/renders could not be made. data.error says why |
template.published |
A template has a new published version |
template.archived |
A template is archived. Your software can no longer print it |
template.restored |
An archived template is back in service |
webhook.test |
Sent only by the test route |
The message never contains a document's values: only identifiers, versions and dates. Only render.completed gives the PDF link, valid for one hour.
Declare an endpoint
curl -X POST https://api.mizanpage.com/v1/webhooks \
-H "Authorization: Bearer mzp_…" \
-H "Content-Type: application/json" \
-d '{"url": "https://erp.example.com/hooks/mizanpage", "events": ["template.published", "document.generated"]}'
Keep the secret (whsec_…) from the response. It is shown only once.
httpsonly, on a public address (no private network and nolocalhost). Redirects are not followed.events:["*"]for all (default), or a list.- 10 endpoints per workspace at most.
- Endpoints are managed with an API key, or in the workspace by a developer or an administrator. Webhooks are open during the free trial and on every plan except Mizanpage Solo.
The message received
POST /hooks/mizanpage
Content-Type: application/json
webhook-id: 0193a5d0-…
webhook-timestamp: 1763714400
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
{
"id": "evt_0193a5d0…",
"type": "template.published",
"timestamp": "2026-11-21T08:40:00Z",
"organisation": { "id": "7c9e6679-…", "ref": "org-42" },
"data": { "template_id": "0193a5b2-…", "external_id": "invoice", "kind": "invoice",
"name": "Invoice", "version": 4, "published_at": "2026-11-21T09:40:00+01:00", "archived": false }
}
For document.generated, data contains generation_id (the same as X-Mizanpage-Generation), template_id, external_id, kind, version, format, api_key_id and created_at.
For render.completed and render.failed, data holds the render: render_id, status, reference, template_id, template_version, generation_id, test, download_url, expires_at and error. See Asynchronous rendering.
Responses and retries
Answer 2xx within 5 seconds, and process later if it takes long. Otherwise, the delivery is retried 7 times over about 27 hours (after 1 min, 5 min, 30 min, 2 h, 5 h, 10 h and 10 h), then abandoned.
webhook-id stays the same on each attempt: ignore an id you have already processed. The order of arrival is not guaranteed. Rely on timestamp and version.
Test and monitor
| Route | Effect |
|---|---|
POST /v1/webhooks/{id}/test |
Sends webhook.test immediately |
GET /v1/webhooks/{id}/deliveries |
The last 50 deliveries, kept for 30 days |
POST /v1/webhooks/{id}/deliveries/{delivery}/retry |
Sends a delivery again |
PATCH /v1/webhooks/{id} |
enabled: false pauses without deleting |
POST /v1/webhooks/{id}/secret |
A new secret, in service immediately |
From your workspace, without code
The Webhooks page, in the Developers group of the left column, does the same without calling the API. It is reserved for developers and administrators.
- Add endpoint: the endpoint URL, a description and the events to listen to. The secret is shown only once.
- Send a test: your server receives
webhook.test, and the page shows its response. - Recent deliveries: each delivery with its result (Received, Retry planned, Given up), the message exactly as it was sent, and Send again.
- The switch pauses an endpoint. The menu offers Edit, New secret and Delete.
To check the signature, see Verify the signature.