Home / Docs / Parameters Reference | HTML to Image Docs

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

ParameterTypeDescription
htmlstringThe HTML content to render. Can include inline CSS and JavaScript.

Optional Parameters

ParameterTypeDefaultDescription
cssstringnullAdditional CSS to inject into the page. Useful for keeping styles separate from HTML.
widthinteger1440Viewport width in pixels. Must be between 1 and 5000.
heightinteger900Viewport height in pixels. Must be between 1 and 5000.
fullpagebooleanfalseWhen true, captures the full page height regardless of viewport height.
dpiinteger2Device pixel ratio for the capture, between 1 and 4. Higher values increase resolution but also processing time.
webhook_urlstringnullURL to receive a JSON callback with the image URL when the render finishes. Recommended for larger images or higher DPI values.
ms_delayintegernullAdds a delay (in milliseconds) before capturing the image, between 1 and 5000. Useful for animations and dynamic content.
wait_for_selectorstringnullWaits for a specific CSS selector to be present before capturing. Note: does not work with iframe content.
formatstringpngOutput format: png for an image or pdf for an A4 document with selectable text.
scale_to_fitbooleanfalsePDF only. Scales content wider than the A4 page to fit the page width and trims trailing blank pages.

Screenshot API Parameters

Required Parameters

ParameterTypeDescription
urlstringThe URL to capture. Must be a valid, publicly accessible URL.

Optional Parameters

ParameterTypeDefaultDescription
cssstringnullAdditional CSS to inject into the page. Useful for modifying the page appearance.
widthinteger1440Viewport width in pixels. Must be between 1 and 5000.
heightinteger900Viewport height in pixels. Must be between 1 and 5000.
fullpagebooleanfalseWhen true, captures the full page height regardless of viewport height.
selectorstringnullCSS selector to capture a specific element instead of the full page. Maximum 255 characters.
dpiinteger1Device pixel ratio for the capture, between 1 and 4. Higher values increase resolution but also processing time.
webhook_urlstringnullURL to receive a JSON callback with the image URL when the render finishes. Recommended for screenshots.
ms_delayintegernullAdds a delay (in milliseconds) before capturing the image, between 1 and 5000. Useful for animations and dynamic content.
wait_for_selectorstringnullWaits for a specific CSS selector to be present before capturing. Note: does not work with iframe content.
formatstringpngOutput format: png for an image or pdf for an A4 document with selectable text.
scale_to_fitbooleanfalsePDF 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."]
    }
}