Skip to main content
POST
Create a PDF

Phase

Phase 1 (Launch) — Core endpoint. Ships day one.

Request

string
HTML content to render as a PDF. Supports full CSS, JavaScript, web fonts, SVG, Canvas — anything Chromium renders. Mutually exclusive with url.
string
URL of a page to render as PDF. PDFBase loads the page in a headless Chromium browser and captures it. Mutually exclusive with html.
string
default:"url"
How to return the generated PDF.
  • url — Returns a signed download URL (recommended). File is stored for your plan’s retention period.
  • base64 — Returns the raw PDF as a base64-encoded string in the response body. Holds the rendering slot until transfer completes.
string
default:"a4"
Page size. One of: a4, a3, a5, letter, legal, tabloid, or a custom object.
object
Custom page dimensions. Overrides format.
  • width (string) — e.g., "210mm", "8.5in", "800px"
  • height (string) — e.g., "297mm", "11in", "1200px"
string | object
default:"20mm"
Page margins. Pass a string for uniform margins ("20mm") or an object for per-side control:
  • top (string)
  • right (string)
  • bottom (string)
  • left (string)
boolean
default:"false"
Render in landscape orientation.
number
default:"1"
Scale of the webpage rendering. Range: 0.1 to 2.0.
object
Page header. Rendered on every page.
  • html (string) — HTML content for the header. Supports Chromium’s special classes: date, title, url, pageNumber, totalPages.
  • height (string) — Header height, e.g., "40mm".
Page footer. Same structure as header.
string
default:"networkidle"
When to consider the page “loaded” before capturing.
  • load — Wait for the load event.
  • domcontentloaded — Wait for DOMContentLoaded.
  • networkidle — Wait until no network requests for 500ms (recommended).
string
CSS selector to wait for before capturing. Useful when content loads dynamically.
integer
Additional milliseconds to wait after wait_until fires. Max: 10000.
string
JavaScript to execute on the page before capturing. Runs after wait_until resolves.
integer
default:"10000"
Max milliseconds to wait for each external resource (fonts, images, stylesheets). Resources that exceed this are skipped.
boolean
default:"true"
Continue rendering even if some resources fail to load. When false, any failed resource causes the request to return an error.
string
default:"none"
Compression level for the output PDF. One of: none, low, medium, high. Higher compression = smaller file, slightly slower.
object
Stamp a text watermark on the generated PDF. For watermarking existing PDFs, see Add watermark (Phase 2).
  • text (string, required) — The watermark text, e.g., “DRAFT”, “CONFIDENTIAL”.
  • color (string, default: “#00000020”) — Color with alpha, hex format.
  • rotation (number, default: -45) — Rotation in degrees.
  • position (string, default: “center”) — One of: center, top-left, top-right, bottom-left, bottom-right.
boolean
default:"false"
Include a screenshot, console output, and failed resource list in the response. See Debug Mode.
integer
default:"30000"
Max milliseconds for the entire rendering operation. Range: 5000 to 120000.
object
Arbitrary key-value pairs stored with the PDF. Useful for linking PDFs to your internal records.

Response

string
Unique identifier, prefixed with pdf_.
string
Always "pdf".
string
One of: completed, completed_with_warnings, failed.
string
Signed download URL. Expires at expires_at. Only present when output: "url".
string
Base64-encoded PDF content. Only present when output: "base64".
integer
Number of pages in the generated PDF.
integer
File size in bytes.
integer
Time spent rendering, in milliseconds. Does not include queue wait time.
array
Present when status is completed_with_warnings. Each warning has code, message, and optionally resource.
object
Present when debug: true. Contains screenshot_url, console array, and failed_resources array.

Examples

Minimal

Full options

From URL