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

  1. 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"}
  2. 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.
  3. 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

MethodPathAuthDescription
POST/auth/registerNoneCreate account (email, password, optional name)
POST/auth/loginNoneGet JWT (email, password)
GET/auth/api-keysBearerList your API keys
POST/auth/api-keysBearerCreate API key (optional body: name)
DELETE/auth/api-keys/:idBearerRevoke 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):

FieldTypeRequiredDefaultDescription
htmlstringYesβ€”Raw HTML (max 5 MB)
formatstringNopngpng | jpeg | webp
scalenumberNo2Device pixel ratio (1–3)
widthnumberNo1280Viewport width (px)
heightnumberNo900Viewport 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.png

Render 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.pdf

Render 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.zip

Errors

Error responses are JSON with error and message. A unique x-request-id header is included for support.

StatusMeaning
400Bad Request β€” invalid JSON or validation failed (e.g. missing html, invalid format).
401Unauthorized β€” missing or invalid x-api-key or Bearer token.
404Not Found β€” e.g. API key ID not found on DELETE.
409Conflict β€” e.g. email already registered.
413Payload Too Large β€” HTML body exceeds 5 MB.
500Internal Server Error β€” render or server failure.
503Service 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 scale to 2 for retina and 3 for high-quality print; 1 for smaller file size.
  • Include x-request-id in support requests when reporting errors.