Hosted preview: the API is not open for requests. These examples document the local API contract; they are not a live endpoint or an invitation to submit private documents.
Presswork API · v1
Restricted HTML to PDF
The API accepts your self-contained HTML and waits for an owned terminal result. Successful PDFs remain available for no more than 24 hours.
Quickstart
curl -X POST http://localhost:3102/v1/renders \
-H "Authorization: Bearer $PRESSWORK_KEY" \
-H "Idempotency-Key: invoice-1042" \
-H "Content-Type: application/json" \
--data '{"html":"<h1>Invoice 1042</h1>","format":"A4","landscape":false}'
# The terminal response includes downloadUrl on success:
curl -H "Authorization: Bearer $PRESSWORK_KEY" \
"http://localhost:3102/v1/renders/JOB_ID?download=1" -o invoice.pdfPOST is deliberately synchronous in V1-local and returns 200 after a terminal succeeded or failed result. A concurrent duplicate can return 409 while the original request owns its short lease. Use the same API key with GET /v1/renders/:id to retrieve status later; append ?download=1 only after success.
Request contract
htmlstring · requiredUTF-8 HTML with inline CSS and embedded raster images.
formatA4 | LetterNo silent paper-size fallback.
landscapebooleanRequired explicit orientation.
Idempotency-Key is required for paid API calls. Reusing a key with identical content returns the original job without another quota use; different content returns 409 IDEMPOTENCY_CONFLICT.
Restrictions
Allowed: semantic HTML, inline CSS, tables, print backgrounds, page breaks, embedded PNG/JPEG/WebP images, and the renderer’s bundled Noto/Liberation fonts.
Rejected: JavaScript, event handlers, forms, frames, SVG, media, file URLs, HTTP(S) URLs, CSS imports, remote fonts and browser automation.
Typed errors
INVALID_FORMAT— paper format is not A4 or LetterEXTERNAL_RESOURCE— markup references a network or file resourceHTML_TOO_LARGE/IMAGES_TOO_LARGE— input crosses a documented boundTOO_MANY_PAGES/RENDER_TIMEOUT— output crosses a runtime boundSUCCESS_LIMIT/ATTEMPT_LIMIT— pass quota or protective attempt limit reached
Privacy and retention
Results are private to the API key that created them and expire after 24 hours. The local metadata store records status, timestamps and quota—not HTML, document titles, keys or URLs. Production hosting still requires a verified durable volume and HTTPS before public launch.