API documentation
Ship your book or report from HTML. The SnapIntact API turns your design into PDF and print-ready images β no reflow, no broken spreads. For an interactive reference, see the OpenAPI docs. Curl examples use this siteβs URL; when calling from another host, use your deployment base URL.
Overview
The SnapIntact API accepts HTML and returns:
- Image β PNG, JPEG, or WebP (single viewport capture)
- PDF β Multi-page PDF (pages detected from your HTML structure)
- ZIP β One image per detected page in a ZIP file
All rendering endpoints require an API key in the x-api-key header. You get API keys by registering, logging in, and creating a key in the dashboard or via the auth API.
Base URL: /api/v1 (e.g. POST /api/v1/snap).
Quick start
- Register and log in (or use the web UI):
# Register curl -X POST https://si.quickplate.dev/api/v1/auth/register \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"your-secure-password"}' # Log in (returns a JWT) curl -X POST https://si.quickplate.dev/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"your-secure-password"}' # Response: {"token":"eyJ...","email":"you@example.com"} - Create an API key (use the token from login):
curl -X POST https://si.quickplate.dev/api/v1/auth/api-keys \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -d '{"name":"My app"}' # Response: {"id":"...","apiKey":"si_xxxxxxxx...","name":"My app","createdAt":"...","message":"Store this key securely..."} # Copy apiKey β it is shown only once. - Call the snap endpoint with your API key:
curl -X POST https://si.quickplate.dev/api/v1/snap \ -H "Content-Type: application/json" \ -H "x-api-key: si_YOUR_API_KEY" \ -d '{"html":"<h1>Hello</h1><p>World</p>","format":"png"}' \ --output screenshot.png
Authentication
API keys (rendering)
Use an API key for /snap, /snap/pdf, and /snap/zip. Send it in the header:
x-api-key: si_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keys have the form si_ plus 32 alphanumeric characters. Create them after logging in via POST /auth/api-keys or in the Dashboard. If a key is revoked, it stops working immediately.
JWT (account & keys)
For registering, logging in, and managing API keys, use the auth endpoints. After POST /auth/login, send the returned token as a Bearer token:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Use this header for GET /auth/api-keys, POST /auth/api-keys, and DELETE /auth/api-keys/:id.
Auth endpoints summary
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /auth/register | None | Create account (email, password, optional name) |
| POST | /auth/login | None | Get JWT (email, password) |
| GET | /auth/api-keys | Bearer | List your API keys |
| POST | /auth/api-keys | Bearer | Create API key (optional body: name) |
| DELETE | /auth/api-keys/:id | Bearer | Revoke an API key |
Endpoints
Health
GET /health β No auth. Returns {"status":"ok","timestamp":"..."}.
Render to image β POST /snap
Renders the HTML in a headless browser and returns a single image. Use for one-page or viewport captures.
Request body (JSON):
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
html | string | Yes | β | Raw HTML (max 5 MB) |
format | string | No | png | png | jpeg | webp |
scale | number | No | 2 | Device pixel ratio (1β3) |
width | number | No | 1280 | Viewport width (px) |
height | number | No | 900 | Viewport height (px) |
curl -X POST https://si.quickplate.dev/api/v1/snap \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_KEY" \
-d '{"html":"<html><body><h1>Hi</h1></body></html>","format":"png","scale":2}' \
-o out.pngRender to PDF β POST /snap/pdf
Renders the HTML and returns a multi-page PDF. Pages are detected from elements matching a page selector (e.g. .page, section, [data-page]). Same request body as /snap.
curl -X POST https://si.quickplate.dev/api/v1/snap/pdf \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_KEY" \
-d '{"html":"<div class=\"page\">Page 1</div><div class=\"page\">Page 2</div>"}' \
-o document.pdfRender to ZIP β POST /snap/zip
Renders each detected page as an image and returns a ZIP containing all of them. Same request body as /snap; format applies to each image.
curl -X POST https://si.quickplate.dev/api/v1/snap/zip \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_KEY" \
-d '{"html":"...","format":"png"}' \
-o pages.zipErrors
Error responses are JSON with error and message. A unique x-request-id header is included for support.
| Status | Meaning |
|---|---|
| 400 | Bad Request β invalid JSON or validation failed (e.g. missing html, invalid format). |
| 401 | Unauthorized β missing or invalid x-api-key or Bearer token. |
| 404 | Not Found β e.g. API key ID not found on DELETE. |
| 409 | Conflict β e.g. email already registered. |
| 413 | Payload Too Large β HTML body exceeds 5 MB. |
| 500 | Internal Server Error β render or server failure. |
| 503 | Service Unavailable β auth/database not configured. |
// Example error body
{"error":"Unauthorized","message":"Missing, invalid, or revoked x-api-key"}Best practices
- Store API keys securely. Never commit them to source control. Use environment variables or a secrets manager.
- Use a single key per environment (e.g. dev, staging, prod) so you can revoke one without affecting others.
- Keep HTML under 5 MB. For large documents, consider splitting or optimizing.
- Set
scaleto 2 for retina and 3 for high-quality print; 1 for smaller file size. - Include
x-request-idin support requests when reporting errors.