Capture a bundle from one navigation
Loads a page once and returns the outputs you select from that one navigation: a screenshot, the rendered_html (the DOM after the page's scripts, readiness and actions, serialised - not the source the server sent), the page's text as the browser lays it out, deterministic markdown made from the rendered HTML, and the page's metadata (title, description, language, canonical address, robots and Open Graph). Every screenshot option applies: device, full page, readiness, actions, success rules, request shaping.
The capture window. After readiness, actions and success rules, the page is read in one script call - HTML, text and metadata together, so they describe one state of the document - and the screenshot is taken immediately after. A page that changes itself (a timer, an animation, live data) can change between the two; the manifest gives both times. A bundle is the page as the browser had it, not an atomic snapshot of the site's data.
Frames. HTML, text and Markdown come from the main frame. The content of iframes, same origin or not, is not included; child_frames in the manifest counts the frames left out. The screenshot shows what was painted, frames included.
Bounds. Rendered HTML up to 5 MiB, text and Markdown up to 1 MiB each, metadata fields up to 2,000 characters. Text and Markdown over their bound are cut at a character boundary and marked truncated; HTML over its bound is omitted with too_large (cutting HTML would give a different document), and so is the Markdown made from it (source_too_large). A page nested too deeply to parse has its Markdown omitted with unparseable. A bundle with none of its outputs left is a 422 bundle_empty and counts nothing. An output is never left out without the manifest saying so.
The response is multipart/form-data: manifest (JSON) first, then each included output as a file part named by output, in the order screenshot, rendered_html, text, markdown. Metadata is in the manifest. The manifest gives each output's size and SHA-256. Captured HTML and text are the page's own content: treat them as untrusted, and never insert the HTML into a page of your own.
Metering. One bundle counts one render.screenshot when it succeeds, whatever outputs it holds; a failure counts nothing. Bundles are never cached. Also available as a job of kind bundle, whose result is the same multipart body.
This endpoint is available on the product-partitioned URL only.
Request
- Base URL: https://api.ironfang.com/render
- URL: https://api.ironfang.com/render/v1/bundle
- Auth: HTTP bearer
Headers
Makes a synchronous render happen, and count, at most once. Any string up to 255 characters, remembered per account. The first request under a key is admitted and rendered as usual; a synchronous result is not kept, so the same request again under the key is a 409 idempotency_key_used and reserves nothing - send a new key to render again. A different request under a used key is a 409 idempotency_conflict. An identical request inside the cache window is still served from cache.
Request body
Example request
{
"actions": [
{
"selector": "#show-more",
"type": "click"
},
{
"selector": "#details",
"type": "wait_for_selector"
}
],
"css": ".chat-widget { display: none !important; }",
"script": "document.querySelector('#pricing')?.click();",
"success_rules": {
"fail_on_status": [
"4xx",
"5xx"
],
"forbid_text": [
"Sign in to continue"
],
"require_selector": "#invoice"
}
}Response
The manifest, then each included output as a file part named by output.
Changes
No recorded changes to this operation across all 1 revision of this API.