The /v1/capture endpoint captures screenshots of websites and returns the binary file data in a format of your choosing (e.g. PNG, JPEG, PDF).

This endpoint may consume API Credits

You will consume 1 API Credit usage in the following situations:

  • When first constructing a new, unique signed request URL
  • When a cached response expires after the ttl (Time To Live) duration

With caching enabled, cache hits to your request URL can be served by our CDN in under 50ms! You're welcome (and indeed, encouraged) to hotlink directly to the API with <img> or <a> tags in your website/app, but you can also download the screenshots and host them separately.

To disable caching, specify a TTL of 0, however note that each request will consume 1 API Credit.

Available Options

url url | required

The target URL to capture.

ttl number | optional | min: 0 | max: 2592000 | default: 86400

The number of seconds to cache the response for (up to 30 days). To disable caching, specify a TTL of 0.

format string | optional | default: jpg

The desired output type (e.g. PNG, JPEG, PDF).

Format Extension Mime Content Type
jpg or jpeg .jpg image/jpeg
webp .webp image/webp
png .png image/png
pdf .pdf application/pdf
viewport_width number | optional | min: 320 | max: 4480 | default: 1360

The width of the window viewport in pixels.

viewport_height number | optional | min: 320 | max: 2520 | default: 768

The height of the window viewport in pixels.

viewport_scale number | optional | min: 1 | max: 3 | default: 1

The device pixel ratio. By combining viewport_width, viewport_height, and viewport_scale, you can emulate specific smartphones and tablets.

fullpage boolean | optional | default: false

If set to true, the output will include the entire height of the page. By default, only the viewport is captured.

fullpage_scroll boolean | optional | default: true

Scroll to the bottom of the page in order to trigger lazy loaded elements. This option is enabled by default and only applicable when fullpage is true.

fullpage_scroll_interval number | optional | min: 10 | max: 500 | default: 50

The delay in milliseconds between each fullpage scroll step. Certain sites may require fine-tuning this option to see what works best. This option is only applicable when fullpage and fullpage_scroll are both set to true.

selector string | optional

Targets a specific element for capture (e.g. #elementId or .className). Using this option will override fullpage.

delay number | optional | min: 0 | max: 5 | default: 0

The number of seconds to wait after document ready to perform the capture.

cookies string | optional

With cookies, you can capture screenshots of "logged in" areas of websites by simply copying cookie values from your browser and reusing them in the API. Set the cookies used when making the request in Cookie-Name=Value,Domain=example.com format. Additional cookie options that can be included are as follows:

· Secure
· HttpOnly

Multiple cookie values may be specified with semicolon delimiter, e.g. PHPSESSID=ck0c9a033dD90daa,Domain=example.com,Secure,HttpOnly;X-Cookie-Banner-Accept=1,Domain=example.com.

Cookies can contain sensitive information. When using this option, you should consider the request URLs you generate to be sensitive in nature and not share them publicly.

headers string | optional

Set HTTP headers for the request in Header-Name=Value format. You can pass multiple headers delimited with semicolons, e.g. Header1=value;Header2=value.

Note: the values you provide in headers may be overridden by more specific options like ua, lang, or authorization.

ua string | optional

The HTTP User-Agent header to use when making the request.

lang string | optional

The HTTP Accept-Language header to use when making the request.

authorization string | optional

The HTTP Authorization header to use when making the request.

When a webpage prompts for a username/password to access it, you can provide these credentials in the HTTP headers when making a request. The credentials must be formatted as follows (username:password) and then base64-encoded (e.g. dXNlcm5hbWU6cGFzc3dvcmQ=).

css url | optional

Injects custom CSS into the page after making the request.

js url | optional

Injects custom JavaScript into the page after making the request.

Copyright © 2024 QED Byte LLC.

Terms of Service · Privacy Policy · Contact Us · Blog · Twitter