API documentation
Create PDFs and screenshots from any URL or HTML, and merge, encrypt or write onto existing PDFs. The API is request-compatible with the Docamatic v1 API, so existing integrations only need a new base URL and key.
Basics
| Base URL | /api/v1 |
|---|---|
| Authentication | Authorization: Bearer YOUR_API_KEY |
| Body | JSON (Content-Type: application/json). Unknown parameters are rejected. |
| Rate limit | 120 requests per minute per key by default (HTTP 429 when exceeded). |
| Storage | Documents are kept for 48 hours by default, then deleted. Delete earlier with DELETE /delete. |
Quick start
curl -X POST /api/v1/pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"source": "https://news.ycombinator.com", "format": "A4", "media": "print"}'
Response
{
"document": "/files/0b9c…e1.pdf",
"size": "85.79 KB",
"success": true,
"transaction_id": "0b9c…e1"
}
With "encode": true, document holds the file as base64 instead of a URL (files over 4 MB still return a URL). Base64 results are not stored.
POST /pdf URL or HTML to PDF
| Parameter | Type | Default | Description |
|---|---|---|---|
source | string | required | A URL (http/https) or an HTML string. |
media | string | screen | screen or print CSS media. |
format | string | Letter | Letter, Legal, Tabloid, Ledger, A0–A5. Overrides width/height. |
width, height | number | Custom paper size (when format is not set). | |
unit | string | cm | Unit for width/height: px, in, cm, mm. |
margin_top, margin_right, margin_bottom, margin_left | number | 0 | Page margins. |
margin_unit | string | cm | px, in, cm, mm. |
landscape | boolean | false | Landscape orientation. |
zoom | number | 1 | Scale, 0.1 to 2. |
disable_backgrounds | boolean | false | Leave out background colours and images. |
grayscale | boolean | false | Black and white output. |
delay | integer | Extra wait before capture, 100–9000 ms. | |
header_template, footer_template | string | HTML for each page's header/footer. Elements with class date, title, url, pageNumber, totalPages are filled in. Set a font-size, as Chrome's default is tiny. | |
header_footer | boolean | Show header and footer. | |
page_numbers | boolean | false | Add "1 / 3" style page numbers (ignored when footer_template is set). |
css | string | CSS string, or a public URL to a stylesheet, injected before rendering. | |
prefer_css_page_size | boolean | false | Use the page's CSS @page size. |
page_ranges | string | all | For example 1-5, 8, 11-13. |
accept_cookie_warning | boolean | true | Accept cookie consent banners automatically. |
click_elements | string[] | Click these before rendering, by button text or CSS selector, e.g. ["Show more", ".expand"]. | |
auth | object | {"username": "…", "password": "…"} for HTTP basic-auth sites. Sent only to the source's own origin. | |
name | string | Document | Label, used as the download file name. |
test | boolean | false | Test mode: "SAMPLE" watermark, uses test credits. |
encode | boolean | false | Return base64 instead of a URL. |
| Extensions (not in Docamatic) | |||
full_page | boolean | false | One continuous page, identical to the page in a desktop browser window. Ignores paper size, margins and headers. |
fit_to_width | boolean | false | Keep the desktop layout and scale it to the paper width (instead of reflowing to a narrow, tablet-like layout). |
viewport_width, viewport_height | integer | 1440, 900 | Browser window size used to load the page. |
wait_for_selector | string | Wait until this CSS selector exists before capturing. | |
POST /image Screenshot
Also available as POST /screenshot. Takes source, media, grayscale, css, delay, accept_cookie_warning, click_elements, auth, name, test, encode as above, plus:
| Parameter | Type | Default | Description |
|---|---|---|---|
file_type | string | png | png, jpg, webp. |
width, height | number | 1440 × 900 | Window size. |
unit | string | px | px, in, cm, mm. |
mobile | boolean | false | Emulate a mobile device (honours the meta viewport tag). |
landscape | boolean | false | Swap width and height. |
full_page | boolean | false | Capture the whole scrollable page. |
clip | object | {"x", "y", "width", "height", "unit"}: capture only this area. | |
quality | number | 1 | Pixel density, 1 to 3. |
POST /template Ready-made documents
Fill a ready-made design with your data. Every field inside data is optional: supply only what you want to show. Try each one with sample data on the Templates tab; GET /template-samples.json returns a complete example request for every template.
{
"template": "shipping_label_4x6",
"data": {
"sender_name": "Acme", "sender_address1": "787 Brunswick", "recipient_name": "Casey Williams",
"recipient_address1": "57 Parkway", "recipient_address2": "New York", "barcode": "18935949030329293"
}
}
| Parameter | Type | Default | Description |
|---|---|---|---|
template | string | required | One of the template IDs below. |
data | object | required | The template's fields. |
lines | array or object | Line items, if not given as data.items (data.lines for quotation2). Also accepts parallel arrays, as Zapier sends them: {"name": ["A", "B"], "price": ["$1", "$2"]}. | |
file_type | string | pdf, png, jpg, webp. | |
format, width, height, unit, landscape | Letter, cm | Paper size, as for /pdf. Ignored by fixed-size labels. | |
font | string | Roboto | Any Google Fonts family name, spelled exactly (e.g. Open Sans). |
font_size | number | 0.8 | Text scale, 0.5 to 1.4. |
font_color | string | #000000 | Text colour (hex). |
quality | number | 1 | Pixel density for images, 1 to 3. |
page_numbers | boolean | false | Page numbers (paged documents only). |
grayscale, test, encode, name | As for /pdf. |
Images (logo, company_logo, item image, signature) can be public URLs or data:image/… URIs. Barcodes are Code 128.
| Template | Size | Main fields |
|---|---|---|
invoice1 Invoice (detailed) | paper | title, color, company_logo, order_number, order_date, payment, shipping, total_items, barcode, qr, bill_to_*, ship_to_*, items[image, description, sku, barcode, quantity, original_price, price, total], note, discount, subtotal, shipping_total, sales_tax_percentage, sales_tax, total, message_title, message_body, company_* (name, address, contact, website, vat_number, facebook/instagram/twitter as true/false). Every heading has a matching *_label field. |
packing_slip1 Packing Slip | paper | As invoice1 without prices, plus po_number, pickup_date, tracking_company, tracking_number, item_image_height, items[number, image, description, sku, barcode, qr, quantity]. |
returns_form Returns Form | paper | order_number, order_date, barcode, company_logo, return_from_*, return_to_*, items[image, description, sku, barcode, quantity], reason_code_a…d with reason_code_a_desc…d_desc, message_title, message_body, company_*. Return #, date and comments are left blank to fill in by hand. |
invoice5 Invoice | paper | logo, title, invoice_number, date, from1…5, to1…5, items[name, description, price], total, currency, button1/2_text, _url, _svg (icon URL), message, header_rule_color, accent_color. |
invoice4 Invoice | paper | title, color, logo, invoice_number, date, date_due, company_* (address1/2, city, state, zip, country, telephone, email, website, vat), bill_to_* (incl. email, vat), items[name, description, quantity, price, original_price, tax, total], discount, subtotal, shipping, sales_tax_label, sales_tax, total, notes. |
invoice3 Invoice (services) | paper | logo, title, invoice_number, date, date_due, company_*, bill_to_*, due, items[name, description, qty, unit_price, price, original_price], notes, discount, subtotal, shipping, sales_tax_label, sales_tax, total, payment_instructions, message, color. |
quotation2 Quotation (detailed) | paper | company{logo, name, address, contact, website}, title, subtitle, quote_name, quote_number, quote_date, quote_expiration, account_rep, phone, email, notes, purchasing_information[attribute, value], lines[description{title, subtitle, configuration[description, sku, quantity]}, quantity, unit_price, original_unit_price, special_price_valid_to, total], comments, sales_tax_percentage, sales_tax, subtotal, total, terms_and_conditions[], color, accent_color. |
commercial_invoice Commercial Invoice | paper | type, logo, invoice_number, airwaybill, export_date, export_reference, exporter_*, consignee_*, buyer_* (each with eori), country_of_export, reason_for_export, country_of_ultimate_destination, items[goods_description, country_of_manufacture, hs_code, unit_of_measure, qty, unit_weight, unit_value, total_value], invoice_total, currency, total_packages, total_weight, incoterm, signature, name, signatory_company, date_signed, color. |
shipping_label_4x6 | 4×6 in, fixed | logo, sender_name, sender_address1…3, sender_telephone, recipient_name, recipient_address1…4, order_number, reference, weight, barcode, instructions (plus *_label fields). |
shipping_label_4x3 | 4×3 in, fixed | sender, recipient_name, recipient_address1…4, reference, weight, barcode (plus *_label fields). |
barcode_label | 4×3 in, resizable | title, subtitle, barcode, label. |
qr_label | 4×3 in, resizable | title, subtitle, qr, label. |
conference_badge | 4×6 in, fixed | logo, qr, first_name, last_name, company, attendee_type, color. |
POST /write Add content to a PDF
source is a PDF URL or base64 string. Positions and sizes are in millimetres from the top-left corner. Omit a *_page_number to apply to every page.
{
"source": "https://example.com/form.pdf",
"text": [{"text_value": "Approved", "text_x": 20, "text_y": 30, "font": "Helvetica", "font_style": "B",
"font_size": 18, "text_color": "#cb4335", "text_page_number": 1}],
"cells": [{"text_value": "A longer paragraph that wraps…", "cell_x": 20, "cell_y": 40, "width": 120,
"height": 6, "align": "J", "border": 1}],
"images": [{"image_url": "https://example.com/logo.png", "image_x": 150, "image_y": 10, "image_width": 40}],
"barcodes": [{"barcode_value": "ABC-123", "barcode_x": 20, "barcode_y": 250}],
"qr_codes": [{"qr_code_value": "https://example.com", "qr_code_x": 170, "qr_code_y": 250, "qr_code_size": 25}],
"page_numbers": true
}
Fonts: Arial, Helvetica, Courier, Times, PassionsConflict, ArchivoBlack. font_style is any of B, I, U. Cells take height (line height, required), width, align (L, C, R, J), border.
POST /merge
{"files": ["https://example.com/a.pdf", "https://example.com/b.pdf"], "name": "Combined"}
2 to 100 PDFs, as URLs or base64 strings, merged in order.
POST /encrypt
{"source": "https://example.com/report.pdf", "password": "pw123#", "encryption": "AES_256"}
encryption is AES_256 (default, Acrobat X or later) or AES_128 (Acrobat 7 or later). Password up to 60 characters. In test mode the password is always sample.
DELETE /delete
{"transaction_id": "0b9c…e1"}
→ {"message": "Delete successful", "url": "…", "success": true}
GET /credits
{"production": {"limit": 1000, "used": 250, "remaining": 750},
"test": {"limit": 1000, "used": 0, "remaining": 1000},
"period_start": "2026-11-01 00:00:00", "period_end": "2026-11-30 23:59:59"}
Also: GET /documents lists your stored documents, GET /templates lists the templates, and GET /me describes your key.
Errors
| Code | Meaning |
|---|---|
| 401 | Missing or invalid API key: {"message": "Unauthenticated."} |
| 403 | Monthly credits used up. |
| 404 / 405 | Unknown route or wrong HTTP method. |
| 408 | The page took too long to render. |
| 415 | The body is not valid JSON. |
| 422 | Validation failed, or the source could not be loaded: {"message": "…", "errors": {"field": ["…"]}} |
| 429 | Rate limit exceeded: {"message": "Too Many Requests"} |
| 500 | Server error. |
For security, URLs that resolve to private or internal network addresses (localhost, 10.x, 192.168.x, cloud metadata) are refused.