API Parameters
This page provides an overview of all available parameters for both the HTML/CSS API and Screenshot API. Click on any parameter to see detailed examples and usage information.
HTML/CSS API Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
html | string | The HTML content to render. Can include inline CSS and JavaScript. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
css | string | null | Additional CSS to inject into the page. Useful for keeping styles separate from HTML. |
width | integer | 1440 | Viewport width in pixels. Must be between 1 and 5000. |
height | integer | 900 | Viewport height in pixels. Must be between 1 and 5000. |
fullpage | boolean | false | When true, captures the full page height regardless of viewport height. |
dpi | integer | 2 | Device pixel ratio for the capture, between 1 and 4. Higher values increase resolution but also processing time. |
webhook_url | string | null | URL to receive a JSON callback with the image URL when the render finishes. Recommended for larger images or higher DPI values. |
ms_delay | integer | null | Adds a delay (in milliseconds) before capturing the image, between 1 and 5000. Useful for animations and dynamic content. |
wait_for_selector | string | null | Waits for a specific CSS selector to be present before capturing. Note: does not work with iframe content. |
format | string | png | Output format: png for an image or pdf for an A4 document with selectable text. |
scale_to_fit | boolean | false | PDF only. Scales content wider than the A4 page to fit the page width and trims trailing blank pages. |
Screenshot API Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The URL to capture. Must be a valid, publicly accessible URL. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
css | string | null | Additional CSS to inject into the page. Useful for modifying the page appearance. |
width | integer | 1440 | Viewport width in pixels. Must be between 1 and 5000. |
height | integer | 900 | Viewport height in pixels. Must be between 1 and 5000. |
fullpage | boolean | false | When true, captures the full page height regardless of viewport height. |
selector | string | null | CSS selector to capture a specific element instead of the full page. Maximum 255 characters. |
dpi | integer | 1 | Device pixel ratio for the capture, between 1 and 4. Higher values increase resolution but also processing time. |
webhook_url | string | null | URL to receive a JSON callback with the image URL when the render finishes. Recommended for screenshots. |
ms_delay | integer | null | Adds a delay (in milliseconds) before capturing the image, between 1 and 5000. Useful for animations and dynamic content. |
wait_for_selector | string | null | Waits for a specific CSS selector to be present before capturing. Note: does not work with iframe content. |
format | string | png | Output format: png for an image or pdf for an A4 document with selectable text. |
scale_to_fit | boolean | false | PDF only. Scales content wider than the A4 page to fit the page width and trims trailing blank pages. |
When using the Screenshot API, we strongly recommend using the webhook_url parameter due to unpredictable page load times. See the webhook_url documentation for more details.
Higher DPI values (2-4) significantly increase processing time and memory usage. For most use cases, a DPI of 1 provides sufficient quality. See the DPI documentation for more details.
The Templates API also accepts format and scale_to_fit alongside each template’s own inputs.
Validation errors
An invalid parameter returns HTTP 400 with a validation_error envelope naming the field and the rule that failed (the Templates API returns 422 instead):
{
"error": "Validation failed",
"code": "validation_error",
"details": {
"width": ["The width field must not be greater than 5000."]
}
}