Capture Screenshot or PDF
rendex_screenshotUse this when the user asks to screenshot, capture, or take a picture of a webpage/URL, or to render raw HTML or Markdown to an image or PDF. Do NOT use to get a reusable hosted image URL (use rendex_render_link) or to make a branded multi-format document (use render_artifact). Captures a screenshot or PDF of any webpage, raw HTML, or Markdown. Supports full-page capture, dark mode, ad blocking, custom viewports, CSS/JS injection, cookie/header injection, PDF output, HTML and Markdown rendering, and progressive fallback for heavy sites. Returns partial renders on timeout by default (bestAttempt mode). Costs 1 render credit per call. Cookie/header injection requires Starter+; geo-targeting requires Pro+.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | No | Custom JavaScript to execute in the page before capture. Runs in the browser sandbox. Max 50KB. | |
| css | No | Custom CSS to inject into the page before capture. Hide cookie banners, add watermarks, override styles. Max 50KB. | |
| geo | No | ISO 3166-1 alpha-2 country code for geo-targeted capture (e.g., 'US', 'DE', 'JP'). Renders the page as seen from that country. Pro/Enterprise only. Note: CSS/JS injection, cookies, element capture, dark mode, and some other features are not available with geo-targeting. | |
| url | No | The webpage URL to capture (a schemeless host like 'example.com' is accepted). Mutually exclusive with 'html' and 'markdown'. | |
| data | No | Key-value data object for Mustache templating. When provided, the 'html' or 'markdown' string is rendered as a logic-less Mustache template before capture — {{var}} inserts HTML-escaped, {{{var}}} inserts raw, {{#items}}...{{/items}} iterates arrays, {{a.b}} accesses nested fields. Not valid with 'url'. Max 256KB serialized. | |
| html | No | Raw HTML to render and capture. Mutually exclusive with 'url' and 'markdown'. Great for invoices, social cards, email templates, OG images. | |
| delay | No | Milliseconds to wait after page load before capture (useful for JS-rendered content) | |
| width | No | Viewport width in pixels (320-3840) | |
| device | No | Device preset that sets viewport, scale factor, and user agent in one shot. E.g. 'iphone_15' for a mobile screenshot. Overrides width/height/deviceScaleFactor/userAgent. | |
| format | No | Output format — png (lossless), jpeg (smaller), webp (smallest), or pdf (document). Use pdf for invoices, reports, archival. | png |
| height | No | Viewport height in pixels (240-2160) | |
| cookies | No | Cookies to set before capture. Useful for authenticated pages. Max 50 cookies. | |
| geoCity | No | City for more precise geo-targeting (e.g., 'Berlin', 'New York'). Requires 'geo'. | |
| headers | No | Custom HTTP headers to send with the page request. Cannot override Host, Connection, Content-Length, or Transfer-Encoding. | |
| quality | No | Image quality 1-100 (JPEG/WebP only, ignored for PNG/PDF) | |
| timeout | No | Maximum seconds to wait for page load (5-60). Cloudflare has a 60s hard cap. | |
| blockAds | No | Block ads and trackers before capture | |
| darkMode | No | Emulate dark color scheme (prefers-color-scheme: dark) | |
| fullPage | No | Capture the full scrollable page instead of just the viewport | |
| geoState | No | State or region for more precise geo-targeting (e.g., 'California'). Requires 'geo'. | |
| markdown | No | Markdown to render to an image or PDF. Mutually exclusive with 'url' and 'html'. The server converts it to HTML before rendering. Great for reports, release notes, README snapshots, documentation cards. | |
| pdfScale | No | PDF scale factor (0.1-2). Default: 1 | |
| selector | No | CSS selector of a specific element to capture instead of the full page. Useful for OG images, component extraction (e.g. '#hero', '.pricing-card') | |
| pdfFormat | No | PDF page size. Only used when format='pdf'. Default: A4 | |
| pdfMargin | No | PDF page margins. Only used when format='pdf'. Accepts CSS values. | |
| userAgent | No | Override the browser user agent string. | |
| waitUntil | No | Page readiness event. networkidle2 (default) is best for most sites. Use domcontentloaded for speed, networkidle0 for completeness. | networkidle2 |
| bestAttempt | No | If true (default), capture whatever is rendered on timeout instead of failing. Set to false to get a hard error on timeout. | |
| resizeWidth | No | Downscale the captured image to this width in pixels (16-3840). Aspect ratio is preserved if resizeHeight is omitted. Ignored for PDF. | |
| pdfLandscape | No | PDF landscape orientation. Only used when format='pdf'. | |
| resizeHeight | No | Downscale the captured image to this height in pixels (16-2160). Aspect ratio is preserved if resizeWidth is omitted. Ignored for PDF. | |
| hideSelectors | No | CSS selectors to hide (display:none) before capture. E.g. ['.modal', '#newsletter-popup'] to remove overlays. Max 50 selectors. | |
| waitForSelector | No | CSS selector to wait for before capture. Essential for SPAs (e.g. '.main-content', '#app-loaded') | |
| deviceScaleFactor | No | Device pixel ratio (1 = standard, 2 = retina). Defaults to 2× Retina. | |
| blockCookieBanners | No | Hide common cookie/consent walls (GDPR/CCPA banners) before capture. A curated selector list, lighter than custom hideSelectors. | |
| blockResourceTypes | No | Block specific resource types to speed up capture. E.g. ['font', 'image'] for text-only screenshots. | |
| pdfPrintBackground | No | Print background colors/images in PDF. Default: true |