Website Logo

Getting Started

ScreenshotAPI is a simple API that allows you to take programmatic screenshots of any website with ease. Screenshots can be saved as JPEG, PNG, WebP, and even PDF! We provide plenty of options.

Hashtag
Render a Screenshot (GET)

GET https://shot.screenshotapi.net/screenshot?token=TOKEN&url=URL&[OPTIONS]

The following options for the API call are:

TOKEN: The TOKEN or your API key should be replaced by your real ScreenshotAPI API, you can find your API key after you Sign Up or Log In to the service via the Dashboard page.

Note: If for any reason you need to get a new API key, simply click "Roll API Key" in the "Settings" card on the Dashboard. This will issue you a fresh API key and revoke access from the previous key.

URL: Website URL for the site you would like to render for the screenshot. We support a wide variety of websites types, such as single page apps, very long-content, and sites that require lazy loading or delays ensuring accurate and complete screenshots of these unique sites.

OPTIONS: Options indicates the different URL parameters keys and values that can be used to render your "perfect" screenshot. All the options for screenshots will be detailed below.

Note: Default options for the screenshot will be shown in the Options table below.

Example:

GET https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https://apple.com

This will render the following png image output when you paste in the above string into your browsers URL bar (replacing TOKEN with your API key):

s

Hashtag
Cached & Fresh screenshot

When you take a screenshot, it automatically get cached on our backend, so when you make a get request to the same URL this will return the same screenshot that got cached, but if you want to take a newer screenshot of the URL provided, you may want to use our fresh screenshot functionality.

Example:

Get https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&fresh=true&[OPTIONS]

In the following video, you will see an example of how the 'Fresh Screenshot' functionality is used. First, we demonstrate how a regular request to a specific URL is made for the first time, which typically takes a few seconds since it's the initial request. Then, the same request is made a second time, which is much faster because it retrieves the cached screenshot. However, if you want to capture a completely new screenshot without using the cached one, you should click the checkbox labeled 'Fresh screenshot' as shown in the example during the third request in the video.

Hashtag
Remove elements from a page

You can select elements by class name, ID, or other CSS selectors and then add the display: none attribute to hide them on the inject CSS feature.

Example:

Get https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&output=image&file_type=png&wait_for_event=load&css=.module-content%7Bdisplay%3A%20none%7D%0A

In the following video, you'll find a more illustrative example of how to use the 'Inject CSS' functionality to remove an element from a page. In the first request, you'll see a standard screenshot to observe the page's initial state. Then, in the second request, we demonstrate how to achieve this by utilizing the 'Inject CSS' feature to remove the desired element.

Hashtag
Scrolling screenshots

You can access the 'Scrolling Screenshot' functionality, which allows you to capture a video (in webm, gif, or mp4 format) of a web page with various customizable options. These options include the ability to scroll backward, adjust scrolling speed, set the duration, and start recording instantly

Example:

Get https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https%3A%2F%2Fgoogle.com&output=json&file_type=gif&wait_for_event=load&scrolling_screenshot=true

In the following video, you'll find a more illustrative example of how to utilize the 'Scrolling Screenshot' functionality. When you click the 'Take Screenshot' button, it will take a few seconds to capture the video and provide you with JSON containing the video information.

Here is the recorded video demonstrating the example.

Hashtag
Multiple Scrolling screenshots

In addition to the 'Scrolling Screenshot' functionality, our application offers the feature of 'Multiple Scrolling Screenshots'. With this feature, you can capture multiple scrolling screenshots of web pages, each with different sizes in terms of width and height. This means you have the flexibility to customize the dimensions of the screenshots according to your specific requirements.

Example:

In the parameters of the endpoint, we will pass an array of objects with different sizes. To achieve this, we need some code to pass this array in the 'sizes' parameter.

let sizesArr = [
{ id: 1, width: 1920, height: 1080 },
{ id: 2, width: 1280, height: 720 },
{ id: 3, width: 800, height: 450 }
];
let SIZES = JSON.stringify(sizesArr);
Get https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&output=json&file_type=gif&wait_for_event=load&scrolling_screenshot=true&multiple_scrolling=true&sizes=SIZES

In the following video, you'll find a more illustrative example of how to utilize the 'Multiple Scrolling Screenshot' functionality. When you click the 'Take Screenshot' button, it will take a few seconds to capture the video and provide you with JSON containing the video information.

Hashtag
Request Options for Screenshots

Hashtag
Request Options

GET https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https://apple.com

Hashtag
Path Parameters

NameTypeDescription

file_type

string

for the file (If output is not set to json), the options include PNG, JPG, WebP, and PDF. The default is PNG

omit_background

boolean

Omit background (If using PNG as the file_type only) removes the background from websites with a basic white background and makes it transparent. Default is false.

destroy_screenshot

boolean

If true, the screenshot will not be stored on our server after render. The resulting screenshot (or PDF) must be deleted (destroyed) when it's rendered as it will not be available again. Default is false

fail_on_error

boolean

If fail on error is set to true, then the API will return an error if the render encounters a 4xx or 5xx status code. Default is false

longitude

number

The longitude to use with the browser's Geolocation API. Default is null

latitude

number

The latitude to use with the browser's Geolocation API. Default is null

proxy

string

Use an address for a proxy server for the request. Example: address:port or username:password@address:port. Default: ' '

no_cookie_banners

string

Block or hide cookie banners on websites as the request loads before render. Default is false

block_ads

boolean

Block ad requests from common and popular ad-networks from loading the request before the render. Default is false

headers

string

Sets the header or headers when the request is being loaded before the render. This works for single or multiple headers. Example: X-HEADER: value; X-OTHER_HEADERL otherValue;. Default is ' '

cookies

string

Sets the cookie or cookies when the request is being loaded before the render. This works for single or multiple cookies. Example: cookie=value;otherCookie=otherValue;. Default is ' '

scroll_to_element

string

Target a specific element for the browser to scroll to before the render. This is useful if a given element is only loaded in the viewport. Default is ' '

selector

string

Specify the target for the render based on a element with a matching selector. If the element is not found, a render of the results is still returned. Example: div > .main-navigation > .logo. Default is ' '

css

string

CSS code injected into the render. Default is ' '

css_url

string

URL for CSS code injected into the render. Default is ' '

ttl

integer

TTL (Time to Live) sets the number of seconds to keep a rendered screenshot (or PDF) in the cache. Default is 30 days or 2592000 seconds

user_agent

string

Sets the User-Agent string for the render for a particular request. Default is ' '

accept_languages

string

Sets the Accept-Language header on the request for the specified URL rendered. Default isen-US,en;q=0.8

delay

integer

Time delay in milliseconds (ms) before the screenshot is rendered from the browser instance (this includes PDFs). Default is 0

thumbnail_width

integer

The width in pixels of the thumbnail generated from the render. If not set, the fallback behavior is the outputted screenshot. Default is null

output

string

Set the output of the results from the render. The output can be either JSON or the raw image captured. Default is image

fresh

string

Take a fresh screenshot or render (or PDF) vs. getting the version cached version within the app's storage. Default is false

lazy_load

boolean

If lazy load is set to true, the browser will cross down the entire page to ensure all content is loaded in the render. Default is false

full_page

boolean

Capture the full page of a website vs. the scrollable area that is visible in the viewport upon render. Default is false

retina

boolean

Retina or a high definition equivalent for a device that sets the pixel ratio to 2X. This option will cause the screenshot processing time to go up due to processing of the larger images. Default is false

height

integer

Viewport height in pixels of the browser render. Default is 867

width

integer

Viewport width in pixels of the browser render. Default is 1680

custom_html

string

Provide custom HTML that should be rendered. This will override the URL option and take a screenshot of the following HTML output. Default is ' '

url

string

The URL of the website for the screenshot / render

token

string

Your API key for Screenshot API

200: OK If output is set to json the following response will be given. Otherwise, output is set to image, the rendered image data will be returned.

{ 	// Response}

Hashtag
Request Options for Scrolling Screenshots

Hashtag
Request Options

GET https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https://apple.com&scrolling_screenshot=true

Hashtag
Path Parameters

NameTypeDescription

file_type

string

for the file the options include WEBM , MP4 and GIF. The default is WEBM

scroll_speed

string

this field stands for the scrolling speed, the options are fast normal and slow . The default is normal.

duration

integer

this field controls the scrolling duration, which in turn affects the video duration in seconds. You can enter a value between 0 and 100

scroll_back

boolean

if this field is set to true , the scrolling will go to the end of the page, and once it's done, it will return to the start of the page.

Hashtag
Errors

ErrorStatus codeDescription

team_not_found

404

Not part of any plan or free trial. Sign up to access our services.

screenshots_limit_reached

403

The usage quota has been exceeded. To continue, please consider upgrading to a plan with a higher quota or adjust the maximum allowed limit if feasible.

token_required

401

The authentication token is missing from the request. Please ensure that the token is included for authentication.

trial_expired

403

Your trial period has expired. To continue using the Screenshot API, pleaseupgrade your plan.

url_required

400

A URL is required for taking screenshot. Please provide a valid URL.

invalid_url

400

Unable to navigate to the provided URL as it is invalid. Please check and provide a valid URL.

timeout_error

408

The request is taking time longer than expected to complete. Try again later.

temporary_unavailable

503

The request cannot be completed due to temporary unavailability something happen like browser closed . Try again later.

invalid_file_type

400

The file type must be PNG , JPEG , WEBP , or PDF .

invalid_proxy

400

The provided proxy URL is invalid. Please check and provide a valid proxy URL.

Invalid_geolocation_parameter

400

The provided geolocation parameter is out of the valid range. Please ensure that the latitude is between -90 and 90 , and the longitude is between -180 and 180 .

invalid_css_url

400

The provided CSS URL is invalid. Please check the URL and ensure it is correctly formatted.

invalid_js_url

400

The provided JS URL is invalid. Please check the URL and ensure it is correctly formatted.

invalid_js_code

400

The provided JS code is invalid. Please check the code and ensure it is correct.

invalid_clipped_area

400

The specified clipped area is invalid. Please verify the parameters and try again.

internal_server_error

500

The API was unable to process your request. You may safely retry the request, as we are notified of any issues and will address them promptly. If the error persists for an extended period, please feel free to contact us for assistance.

invalid_input_syntax

400

The provided input is not valid for the expected integer format. Please ensure that the input is a valid integer .

Hashtag
Query Builder

Use our Query Builder to explore our API. (If you are logged in your API key is automatically added). To easily view all the screenshot options in an interactive builder to ensure you have your ideal screenshot dialed in.

You can check out the Query Builder here: ScreenshotAPI.net .

Hashtag
Inject JavaScript

Inject Javascript field is a javascript code that the browser can execute before taking the screenshot.

For example: Try taking a screenshot of ScreenshotAPI.net and paste this code in the "Inject JS code" input of the query builder:

document.getElementsByClassName('display-heading')[0].innerHTML = 'This is a test to help the customer'

Hashtag
Page Range

We added a new option recently specifically for the PDF output. You can select the range that you want to select. Sometimes if the screenshot has unnecessary details that bleed into another page and you want to remove that from the screenshot, you can customize the page range that gets outputted directly from the Query Builder.

Page Range option added to the PDF option
pdf_options%5Bpage_range%5D)=1-1

Hashtag
Extract HTML or Text

This option on the query builder allows you to store the HTML and the text of the site. You currently need to set the output as json to grab the URLs. If you are using the img output, for example, we will extract the information but there is no way to grab the URLs.

Hashtag
Code Examples

Below is sample code for the following languages: Node.JS, PHP, Go, Java, Python, and Ruby.

If you need assistance integrating into our API with a given language please contact us.

var fs = require("fs");var request = require("request");

// @param {String} token - String containing your API Key// @param {String} url - Encoded URI string container the URI you're targeting// @param {String} output - String specifying the output format, 'image' or 'json'// @param {String} file_type - String specifying the output typevar token = "Your API Key";var url = encodeURIComponent("https://google.com");var output = "image";var file_type = "png";

// Construct the query params and URLvar query = "https://shot.screenshotapi.net/screenshot";query += `?token=${token}&url=${url}&output=${output}&file_type=${file_type}`;

// Call the API and save the screenshotrequest.get({ url: query, encoding: "binary" }, (err, response, body) => { 	fs.writeFile("screenshot.png", body, "binary", (err) => {		 if (err) {			 console.log(err); 		 } else {			 console.log("The file was saved!"); 		 }  	}); });```

Hashtag
Proxy

We have a free proxy you can use if you need one: http://xo:llksoigsgrewvc@137.184.64.168:3128

Hashtag
Support

At ScreenshotAPI we are there for you. We are developers ourselves and strive to ensure you have a great screenshot experience.

If the ScreenshotAPI.net API is unavailable to all for more than three consecutive hours in any one calendar day, beginning at 12:00:01 AM PST and ending at 11:59:59 PM PST time of the same day, an outage will be deemed to have occurred. If there are more than three outages within any one calendar week, beginning at 12:00:01 AM PST on a Monday and ending at 11:59:59 PM PST on a Sunday, then You may terminate this Agreement, without liability, by providing written notice to ScreenshotAPI.net of Your intention to do so within one calendar week of the third outage. Upon such termination being accepted by ScreenshotAPI.net, You shall be entitled to a refund equal to the amount You have paid for the latest term.

If you need help at any point please contact us at info@screenshotapi.net or go to Help Desk