Templates

Render a template

Substitutes vars into the template's {{placeholders}} and renders it at the template's own width and height. Returns the image bytes.

post/v1/image/{id}

Request

  • Base URL: https://api.ironfang.com/render
  • URL: https://api.ironfang.com/render/v1/image/{id}
  • Auth: HTTP bearer

Request body

authorizationstring

Sets the Authorization header - the common case, spelled once. An explicit Authorization in headers wins over this.

block_adsboolean

Drop requests to known ad and tracker networks before they load. Stopped as network requests rather than hidden afterwards, so the page never spends time fetching them.

block_cookie_bannersboolean

Hide common consent banners, and undo the scroll lock they set - without which a full-page capture is one viewport tall.

Hidden, not accepted. Clicking "accept" would be a decision made on the site owner's behalf and recorded as theirs.

cssstring

Custom stylesheet, at most 65536 UTF-8 bytes. Applied after normal load/wait conditions and built-in hiding, before script, actions, settling and capture. Supports screenshots and PDFs, including @media print rules. Malformed stylesheet syntax is a 400 bad_request; Chromium determines supported properties and values.

device_scale_factornumber

Pixel density. 2 is retina: the same CSS size at twice the pixels.

headersobject

Extra HTTP headers sent with every request for the page.

hide_selectorsstring[]

CSS selectors to hide before capturing. Applied after load, so elements injected by script are covered.

no_cacheboolean

Force a fresh render instead of serving a cached one. Always billable. Excluded from the cache key, so repeated fresh requests do not collide.

scriptstring

JavaScript statements executed inside the target page's main-frame context after load/wait conditions and css, before actions and capture. Runs as an async function body: use await or return a promise for asynchronous work. Completion is awaited; return values are discarded. At most 16384 UTF-8 bytes and 5000 ms execution, further bounded by the remaining timeout_ms budget. Syntax errors, execution failures and timeouts return 422 render_failed with a sanitized message. Supports screenshots and PDFs; no browser-session or Playwright/Puppeteer APIs are exposed.

timeout_msinteger

Per-render timeout. Clamped to the service maximum - it can lower the ceiling but not raise it.

user_agentstring

Overrides the user agent, including any set by device.

wait_for_selectorstring

Wait for this element before capturing. Fails the render if it never appears, rather than returning a half-drawn page.

wait_until'load' | 'domcontentloaded' | 'networkidle'

When the page counts as ready. networkidle waits for traffic to stop and is bounded by the render timeout, because a page with polling never truly idles.

format'png' | 'jpeg' | 'webp'
varsobject

Values for the template's placeholders.

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();"
}

Response

The rendered image. png unless format: jpeg was requested.

Changes

No recorded changes to this operation across all 1 revision of this API.