Get Started
Templating
API Documentation
Sync/Async options
From Template async
Queue the creation of the template and call the webhook with the result.
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Page options.
URL to go to. Should include the scheme, e.g. https://
HTML to render. Needs to be base64 encoded!
HTML template to render, uses Handlebars to render your HTML together with the provided templateData
. Needs to be base64 encoded!
Template data, only used in combination with page.htmlTemplate
.
When to consider waiting succeeds.
auto
our smart waiting option that can handle 90% of the cases.load
waits for the 'load' event.domcontentloaded
waits for the 'DOMContentLoaded' event.networkidle0
waits till there are no more than 0 network connections for at least500
ms.networkidle2
waits till there are no more than 2 network connections for at least500
ms.
Wait for a certain amount of milliseconds before the request continues.
The selector of an element to wait for.
Options for configuring waiting behavior.
Wait for the selected element to be present in DOM and to be visibleAn element is considered to be visible if all of the following is true:
- the element has computed styles
- the element has a non-empty bounding client rect
- the element's visibility is not
hidden
orcollapse
Wait for the selected element to not be found in the DOM or to be hidden.An element is considered to be hidden if at least one of the following is true:
- the element has no computed styles
- the element has an empty bounding client rect
- the element's visibility is
hidden
orcollapse
Maximum time to wait in milliseconds.
Wait for the pageFunction
to execute in the page. If the pageFunction
doesn't execute successfully after the timeout
milliseconds of waiting, the request will continue.
Function to be evaluated in browser context until it returns a truthy value.
Options for configuring waiting behavior.
An interval at which the pageFunction
is executed, defaults to raf
. If polling
is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling
is a string, then it can be one of the following values:
raf
to constantly executepageFunction
inrequestAnimationFrame
callback. This is the tightest polling mode which is suitable to observe styling changes.mutation
to executepageFunction
on every DOM mutation.
Maximum time to wait in milliseconds.
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
Use our build-in adblocker.
Whether or not to enable JavaScript on the page.
Cookies added to the page, Also accepted as string inside headers.cookie
.
Provide credentials for HTTP authentication
.
Color-scheme to set on the page.
Changes the CSS media type of the page.
Changes the timezone of the page. See ICU’s metaZones.txt for a list of supported timezone IDs.
Screenshot options, only used if Template's output is "SCREENSHOT".
Device preset to use, will not be set when viewport
option is provided!
Define an custom viewport, when defined the device
option will be ignored!
The page width in CSS pixels.
The page height in CSS pixels.
Specify device scale factor. See devicePixelRatio for more info.
Whether the meta viewport
tag is taken into account.
Specify if the viewport supports touch events.
Specifies if the viewport is in landscape mode.
When true
, takes a screenshot of the full page.
Capture the screenshot from the surface, rather than the view.
Hides default white background and allows capturing screenshots with transparency.
Quality of the image, between 0-100. Not applicable to png
images.
Capture the screenshot beyond the viewport. false
if there is no clip
. true
otherwise.
Specifies the region of the page to clip.
The width of the element in pixels.
The height of the element in pixels.
It captures the DOM element matching the given CSS selector. This will overwrite the clip
property and set fullPage
to false
. Will wait for the element to become visible for a maximum of 15 seconds.
Add an overlay to the image. Cannot be used together with the fullPage
option!
Color to apply as background, can be an an hexadecimal/rgb/rgba color code or CSS gradient.
Apply CSS Filter to background.
Margin to apply.
Browser to apply.
The border radius, specified in CSS pixels, is applied to the screenshot only when the device
option is not set.
Pdf options, only used if Template's output is "PDF".
Scales the rendering of the web page. Amount must be between 0.1
and 2
.
Whether to show the header and footer.
HTML template for the print header. Should be valid HTML (base64 encoded) with the following classes used to inject values into them:
date
formatted print datetitle
document titleurl
document locationpageNumber
current page numbertotalPages
total pages in the document
HTML template for the print footer. Has the same constraints and support for special classes as headerHtml
.
Set to true
to print background graphics.
Whether to print in landscape orientation.
Paper ranges to print, e.g. 1-5, 8, 11-13
.
If set, this takes priority over the width
and height
options.
The sizes of each format are as follows:
letter
8.5in x 11inlegal
8.5in x 14intabloid
11in x 17inledger
17in x 11ina0
33.1in x 46.8ina1
23.4in x 33.1ina2
16.54in x 23.4ina3
11.7in x 16.54ina4
8.27in x 11.7ina5
5.83in x 8.27ina6
4.13in x 5.83in
Sets the width of paper. You can pass in a number or a string with a unit.
Sets the height of paper. You can pass in a number or a string with a unit.
Give any CSS @page size declared in the page priority over what is declared in the width
or height
or format
option.
Set the PDF margins.
Hides default white background and allows generating pdfs with transparency.
Generate document outline. If this is enabled the PDF will also be tagged (accessible).
Generate tagged (accessible) PDF. This is experimental and will increase the size of the PDF.
Pre-signed url to upload the generated pdf/screenshot to. Should include the scheme, e.g. https://
Webhook to call when screenshot is generated.
The way this webhook wants to receive the result.
- When
URL
is used an temporary URL will be provided to download the file (the file will be automatically deleted after 1 hour). - When
base64
is used make sure your webhook can receive the size of the file!
The webhook's URL. Should include the scheme, e.g. https://
Method to use when calling the webhook.
An object containing additional HTTP headers to be sent with the webhook. All header values must be strings.
Additional metadata that will be inside the request when the webhook is called. All values must be strings. Max 1kB.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
Body
Webhook to call when screenshot is generated.
The webhook's URL. Should include the scheme, e.g. https://
The way this webhook wants to receive the result.
- When
URL
is used an temporary URL will be provided to download the file (the file will be automatically deleted after 1 hour). - When
base64
is used make sure your webhook can receive the size of the file!
base64
, URL
Method to use when calling the webhook.
POST
, PUT
An object containing additional HTTP headers to be sent with the webhook. All header values must be strings.
Additional metadata that will be inside the request when the webhook is called. All values must be strings. Max 1kB.
Page options.
URL to go to. Should include the scheme, e.g. https://
HTML to render. Needs to be base64 encoded!
HTML template to render, uses Handlebars to render your HTML together with the provided templateData
. Needs to be base64 encoded!
Template data, only used in combination with page.htmlTemplate
.
When to consider waiting succeeds.
auto
our smart waiting option that can handle 90% of the cases.load
waits for the 'load' event.domcontentloaded
waits for the 'DOMContentLoaded' event.networkidle0
waits till there are no more than 0 network connections for at least500
ms.networkidle2
waits till there are no more than 2 network connections for at least500
ms.
auto
, load
, domcontentloaded
, networkidle0
, networkidle2
Wait for a certain amount of milliseconds before the request continues.
0 < x < 5000
Wait for the selector to appear in page. If the selector doesn't appear after the timeout
milliseconds of waiting, the request will continue.
The selector of an element to wait for.
1 - 1024
Options for configuring waiting behavior.
Wait for the selected element to be present in DOM and to be visibleAn element is considered to be visible if all of the following is true:
- the element has computed styles
- the element has a non-empty bounding client rect
- the element's visibility is not
hidden
orcollapse
Wait for the selected element to not be found in the DOM or to be hidden.An element is considered to be hidden if at least one of the following is true:
- the element has no computed styles
- the element has an empty bounding client rect
- the element's visibility is
hidden
orcollapse
Maximum time to wait in milliseconds.
1 < x < 30000
Wait for the pageFunction
to execute in the page. If the pageFunction
doesn't execute successfully after the timeout
milliseconds of waiting, the request will continue.
Function to be evaluated in browser context until it returns a truthy value.
1 - 1024
Options for configuring waiting behavior.
An interval at which the pageFunction
is executed, defaults to raf
. If polling
is a number, then it is treated as an interval in milliseconds at which the function would be executed. If polling
is a string, then it can be one of the following values:
raf
to constantly executepageFunction
inrequestAnimationFrame
callback. This is the tightest polling mode which is suitable to observe styling changes.mutation
to executepageFunction
on every DOM mutation.
raf
, mutation
Maximum time to wait in milliseconds.
1 < x < 30000
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
Use our build-in adblocker.
Whether or not to enable JavaScript on the page.
Cookies added to the page, Also accepted as string inside headers.cookie
.
Cookie name.
1 - 1024
Cookie value.
1 - 4096
Cookie domain.
1 - 512
The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie. Should include the scheme, e.g. https://
Cookie path.
1 - 512
true
if cookie is secure.
true
if cookie is http-only.
Cookie SameSite type.
Strict
, Lax
, None
Cookie expiration date (UTC time in seconds, counted from January 1, 1970.), session cookie if not set.
Color-scheme to set on the page.
20
Changes the CSS media type of the page.
screen
, print
Changes the timezone of the page. See ICU’s metaZones.txt for a list of supported timezone IDs.
Screenshot options, only used if Template's output is "SCREENSHOT".
png
, jpeg
, webp
Device preset to use, will not be set when viewport
option is provided!
Blackberry PlayBook
, Blackberry PlayBook landscape
, BlackBerry Z30
, BlackBerry Z30 landscape
, Galaxy Note 3
, Galaxy Note 3 landscape
, Galaxy Note II
, Galaxy Note II landscape
, Galaxy S III
, Galaxy S III landscape
, Galaxy S5
, Galaxy S5 landscape
, Galaxy S8
, Galaxy S8 landscape
, Galaxy S9+
, Galaxy S9+ landscape
, Galaxy Tab S4
, Galaxy Tab S4 landscape
, iPad
, iPad landscape
, iPad (gen 6)
, iPad (gen 6) landscape
, iPad (gen 7)
, iPad (gen 7) landscape
, iPad Mini
, iPad Mini landscape
, iPad Pro
, iPad Pro landscape
, iPad Pro 11
, iPad Pro 11 landscape
, iPhone 4
, iPhone 4 landscape
, iPhone 5
, iPhone 5 landscape
, iPhone 6
, iPhone 6 landscape
, iPhone 6 Plus
, iPhone 6 Plus landscape
, iPhone 7
, iPhone 7 landscape
, iPhone 7 Plus
, iPhone 7 Plus landscape
, iPhone 8
, iPhone 8 landscape
, iPhone 8 Plus
, iPhone 8 Plus landscape
, iPhone SE
, iPhone SE landscape
, iPhone X
, iPhone X landscape
, iPhone XR
, iPhone XR landscape
, iPhone 11
, iPhone 11 landscape
, iPhone 11 Pro
, iPhone 11 Pro landscape
, iPhone 11 Pro Max
, iPhone 11 Pro Max landscape
, iPhone 12
, iPhone 12 landscape
, iPhone 12 Pro
, iPhone 12 Pro landscape
, iPhone 12 Pro Max
, iPhone 12 Pro Max landscape
, iPhone 12 Mini
, iPhone 12 Mini landscape
, iPhone 13
, iPhone 13 landscape
, iPhone 13 Pro
, iPhone 13 Pro landscape
, iPhone 13 Pro Max
, iPhone 13 Pro Max landscape
, iPhone 13 Mini
, iPhone 13 Mini landscape
, iPhone 14
, iPhone 14 landscape
, iPhone 14 Plus
, iPhone 14 Plus landscape
, iPhone 14 Pro
, iPhone 14 Pro landscape
, iPhone 14 Pro Max
, iPhone 14 Pro Max landscape
, iPhone 15
, iPhone 15 landscape
, iPhone 15 Plus
, iPhone 15 Plus landscape
, iPhone 15 Pro
, iPhone 15 Pro landscape
, iPhone 15 Pro Max
, iPhone 15 Pro Max landscape
, JioPhone 2
, JioPhone 2 landscape
, Kindle Fire HDX
, Kindle Fire HDX landscape
, LG Optimus L70
, LG Optimus L70 landscape
, Microsoft Lumia 550
, Microsoft Lumia 950
, Microsoft Lumia 950 landscape
, Nexus 10
, Nexus 10 landscape
, Nexus 4
, Nexus 4 landscape
, Nexus 5
, Nexus 5 landscape
, Nexus 5X
, Nexus 5X landscape
, Nexus 6
, Nexus 6 landscape
, Nexus 6P
, Nexus 6P landscape
, Nexus 7
, Nexus 7 landscape
, Nokia Lumia 520
, Nokia Lumia 520 landscape
, Nokia N9
, Nokia N9 landscape
, Pixel 2
, Pixel 2 landscape
, Pixel 2 XL
, Pixel 2 XL landscape
, Pixel 3
, Pixel 3 landscape
, Pixel 4
, Pixel 4 landscape
, Pixel 4a (5G)
, Pixel 4a (5G) landscape
, Pixel 5
, Pixel 5 landscape
, Moto G4
, Moto G4 landscape
, Macbook Pro 13
, Macbook Pro 15
, Macbook Pro 16
, iMac 21
, iMac 21 4K
, iMac 24 4.5K
, iMac 27
, iMac 27 5K
Define an custom viewport, when defined the device
option will be ignored!
The page width in CSS pixels.
0 < x < 4480
The page height in CSS pixels.
0 < x < 2520
Specify device scale factor. See devicePixelRatio for more info.
1 < x < 3
Whether the meta viewport
tag is taken into account.
Specify if the viewport supports touch events.
Specifies if the viewport is in landscape mode.
When true
, takes a screenshot of the full page.
Capture the screenshot from the surface, rather than the view.
Hides default white background and allows capturing screenshots with transparency.
Quality of the image, between 0-100. Not applicable to png
images.
0 < x < 100
Capture the screenshot beyond the viewport. false
if there is no clip
. true
otherwise.
Specifies the region of the page to clip.
The width of the element in pixels.
0 < x < 4480
The height of the element in pixels.
0 < x < 2520
x > 0
It captures the DOM element matching the given CSS selector. This will overwrite the clip
property and set fullPage
to false
. Will wait for the element to become visible for a maximum of 15 seconds.
Add an overlay to the image. Cannot be used together with the fullPage
option!
Color to apply as background, can be an an hexadecimal/rgb/rgba color code or CSS gradient.
Apply CSS Filter to background.
Margin to apply.
0 < x < 1
Browser to apply.
light
, dark
The border radius, specified in CSS pixels, is applied to the screenshot only when the device
option is not set.
Pdf options, only used if Template's output is "PDF".
Scales the rendering of the web page. Amount must be between 0.1
and 2
.
0.1 < x < 2
Whether to show the header and footer.
HTML template for the print header. Should be valid HTML (base64 encoded) with the following classes used to inject values into them:
date
formatted print datetitle
document titleurl
document locationpageNumber
current page numbertotalPages
total pages in the document
HTML template for the print footer. Has the same constraints and support for special classes as headerHtml
.
Set to true
to print background graphics.
Whether to print in landscape orientation.
Paper ranges to print, e.g. 1-5, 8, 11-13
.
If set, this takes priority over the width
and height
options.
The sizes of each format are as follows:
letter
8.5in x 11inlegal
8.5in x 14intabloid
11in x 17inledger
17in x 11ina0
33.1in x 46.8ina1
23.4in x 33.1ina2
16.54in x 23.4ina3
11.7in x 16.54ina4
8.27in x 11.7ina5
5.83in x 8.27ina6
4.13in x 5.83in
letter
, legal
, tabloid
, ledger
, a0
, a1
, a2
, a3
, a4
, a5
, a6
Sets the width of paper. You can pass in a number or a string with a unit.
Sets the height of paper. You can pass in a number or a string with a unit.
Give any CSS @page size declared in the page priority over what is declared in the width
or height
or format
option.
Hides default white background and allows generating pdfs with transparency.
Generate document outline. If this is enabled the PDF will also be tagged (accessible).
Generate tagged (accessible) PDF. This is experimental and will increase the size of the PDF.
Was this page helpful?