Render HTML

Send HTML in the body of POST /v1/take and get it back as a PDF, a screenshot or markdown, for example invoices, reports or certificates that your application generates. All options of the take endpoint work, including the PDF options and markdown.

Send HTML

Send a JSON body with html and the options you need. The response is the file itself, as for GET /v1/take.

HTML to PDF

POST
/v1/take
curl https://api.screenshotbase.com/v1/take \
    -H "apikey: YOUR-API-KEY" \
    -H "Content-Type: application/json" \
    -d '{"html": "<h1>Invoice INV-42</h1><p>Total: EUR 49.00</p>", "format": "pdf", "pdf_margin": "15mm"}' \
    -o invoice.pdf

Check the status code before you save the body: errors come back as JSON (see status codes).

The request body

  • html: the HTML to render, at most 10 MB (10,485,760 bytes of UTF-8), or 50 MB (52,428,800 bytes) with async=1, so larger documents go through an async job. Send a whole document or a fragment; a fragment is rendered like a page with that body.
  • markdown: markdown to render instead of html, see Markdown input.
  • Any option of GET /v1/take as a JSON field: format, viewport_width, full_page, hide_selectors (an array of selectors), styles, the pdf_* options, upload, attachment_name and so on. Booleans may be true/false or 1/0.
  • url: the POST endpoint also renders a URL, with the same rules as GET /v1/take. Send exactly one of url, html and markdown.

html and markdown belong in the request body. In the query string they are refused with a 422, on POST and GET alike, because URLs end up in logs.

Markdown input

Send markdown instead of html to render a README, release notes or a report you write in markdown, as a PDF, a screenshot or markdown again. It is converted to an HTML page and then rendered exactly like html, with the same options, time limit and cost.

curl https://api.screenshotbase.com/v1/take \
    -H "apikey: YOUR-API-KEY" \
    -H "Content-Type: application/json" \
    -d '{"markdown": "# Release notes\n\n| Version | Date |\n| --- | --- |\n| 2.4 | 2026-10-10 |\n\n- [x] Faster exports", "format": "pdf", "pdf_margin": "15mm"}' \
    -o notes.pdf
  • GitHub's flavor of markdown: tables, task lists, strikethrough and autolinks. At most 1 MB (1,048,576 bytes), and it must be UTF-8.
  • The page has a readable default style: system fonts in a centered column of 980 px, with a dark variant for prefers-color-scheme: dark and print rules for PDFs. styles can change it, as for any page.
  • The first level-1 heading becomes the page's title (the {title} of a PDF template, the title of a markdown JSON response).
  • Raw HTML in the markdown is kept and rendered as html would be. Links with a javascript: or data: target lose it. Relative URLs do not resolve, as for html.
  • Markdown that is too large or too complex to convert answers 422 (The markdown field could not be converted to HTML: ...), not billed. When the server converts as much markdown as it may at once, the request answers 503 renderer_busy with Retry-After: 5, also not billed.
  • An async job keeps the converted page, encrypted, never the markdown.

The HTML is rendered as an https page on an address of its own, so:

  • Relative URLs do not resolve. Use absolute URLs (https://www.example.com/logo.png), embed small files as data: URLs, or add a base element to the head of your document, as shown below.
  • Plain http resources: http:// images are upgraded to https; other http:// resources, such as stylesheets, scripts or fonts, are blocked as mixed content. Serve them over https.
  • Internal addresses are never loaded. Everything the HTML references is held to the same rules as a page from a URL: resources on private, loopback, link-local or other reserved addresses and internal host names are not fetched, and navigations to them are blocked (see status codes).

Resolve relative URLs with a base element

<!doctype html>
<html>
<head>
    <base href="https://www.example.com/assets/">
    <link rel="stylesheet" href="invoice.css">
</head>
<body>
    <img src="logo.png" alt="Example Inc.">
    <h1>Invoice INV-42</h1>
</body>
</html>

JavaScript in the HTML runs as in a browser, so pages that build their content with script work. The wait_until, delay and block_* options apply as for URLs.

Time limit

A render of HTML must finish within 110 seconds of the start of the request: loading what the HTML references, the delay (at most 30 seconds), and printing or taking the screenshot. A render that takes longer is stopped and answered with 408; it is not billed. Through the MCP server, a tool call must finish within about 12 seconds, and delay is at most 7 there. HTML that needs longer can be rendered as an async job, with up to 300 seconds.

Privacy

We do not keep the HTML you send: it is written to a temporary file for the render and deleted afterwards. The result is stored only when you pass upload=1. An async job keeps its HTML encrypted, with its result, until the job is deleted, at most 7 days after it finished.

Errors

Besides the errors of GET /v1/take, a request with HTML can answer:

  • 422 with Send only one of url, html and markdown. or Either the url, the html or the markdown field is required.;
  • 422 with The html field must not be larger than 10 MB (10485760 bytes); with async=true up to 50 MB., or The markdown field must not be larger than 1 MB (1048576 bytes).;
  • 422 with The html field is only accepted in the JSON body of a POST request. (the same for markdown);
  • 422 with The markdown field must be UTF-8 text. or The markdown field could not be converted to HTML: ...;
  • 500 with The page could not be rendered. when the HTML could not be rendered for another reason.

None of them is billed. The status codes page lists all errors.

AI agents (MCP)

On the MCP server, this endpoint is the takePost tool. A screenshot arrives as an image and a PDF as an embedded resource, up to 3 MB; for a larger file, pass upload: true and use the URL of the stored file.

Sandbox keys

A sandbox API key returns a placeholder file of the requested format without rendering the HTML, at no cost (X-Cost: 0).