API docs
Merge webhook JSON into an HTML template, then return a PDF by default. Sync for interactive calls, async for bursts. Try the live sandbox or get an API key.
Authentication
Create a key under Account. Send it on every request:
Authorization: Bearer dh_… # or X-DocuHook-Key: dh_…
Email must be verified before keys work.
Sync render
POST /api/v1/render — merge data + html, then return a PDF by default (Dompdf after merge — not Chromium).
POST https://docuhook.com/api/v1/render
Authorization: Bearer dh_…
Content-Type: application/json
{
"mode": "sync",
"data": { "invoice": { "number": "INV-1" } },
"html": "<h1>{{invoice.number}}</h1>",
"filename": "invoice.pdf"
}
→ 200 application/pdf (binary)
- Default /
"format": "pdf"/Accept: application/pdf→ PDF file - Tokens use Handlebars-style paths:
{{customer.name}}
HTML-only merge (opt-in)
Need the filled HTML only (e.g. convert yourself)? Set "format": "html" or send Accept: application/json.
{
"mode": "sync",
"format": "html",
"data": { "invoice": { "number": "INV-1" } },
"html": "<h1>{{invoice.number}}</h1>"
}
→ text/html or Accept: application/json → {"html":"…","format":"html"}
Complex CSS may render differently in Dompdf than in Chrome. For pixel-perfect print CSS, use format: html and convert client-side (sandbox uses html2pdf.js).
Async (bursts)
When webhooks pile up, don’t hold the HTTP connection. Use "mode": "async" or header Prefer: respond-async.
→ 202 Accepted
{
"job_id": "job_…",
"status_url": "/api/v1/jobs/job_…",
"result_url": "/api/v1/jobs/job_…/result"
}
GET /api/v1/jobs/{id}— statusGET /api/v1/jobs/{id}/result— HTML (or PDF if the job usedformat: pdf/?format=pdf)
Webhook alias
Same body as /render, aimed at Zapier / SaaS outbound hooks:
POST /api/v1/hooks/render Authorization: Bearer dh_…
Client SDKs
Official clients — install from the package manager, source on GitHub:
| Runtime | Install | GitHub |
|---|---|---|
| Node.js | npm install @docuhook/node | docuhook-node |
| React | npm install @docuhook/react @docuhook/node | docuhook-react |
| PHP | composer require docuhook/docuhook | docuhook-php |
| Python | pip install docuhook-client | docuhook-python |
| Go | go get github.com/rustemas/docuhook-go | docuhook-go |
Profile: github.com/rustemas
WordPress / WooCommerce plugin
GitHub: rustemas/docuhook-woocommerce
Lightweight connector for WooCommerce / custom hooks.
- Download docuhook.zip
- WP Admin → Plugins → Upload → Activate
- Settings → DocuHook → API URL
https://docuhook.com+ your key - Call
docuhook_render( $data, $html, $args )from themes/plugins