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.
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):
POST https://shot.screenshotapi.net/screenshot
POST mode accepts the exact same parameters in the request body, but you need to use a JSON.
get
https://shot.screenshotapi.net/screenshot?token=TOKEN&url=https://apple.com
Request Options
In rare circumstances the API may encounter an "Error 524" from Cloudflare. This is due to a timeout between the ScreenshotAPI API and our servers due to auto-scaling. If you see this error please just try your request again.
You may also receive an error if you select the
no_cookies_banner
as TRUE and try to export as a PDF. There are some limitations that do not allow these two settings to happen at the same time.With each API call the following quota headers are sent.
X-Quota-Limit
X-Quota-Remaining
X-Quota-Reset-At
The total number of screenshots you can take per month
The number of screenshots you can still make this month
A unix timestamp of when the quota resets (the first of each month)
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.
Inject Javascript field is a javascript code that the browser can execute before taking the screenshot.

For example: Try taking a screenshot of https://xo.capital/ 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'

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
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.

Below is sample code for the following languages: Node.JS, PHP, Go, Java, Python, and Ruby.
NodeJS
PHP
Go
Java
Python
Ruby
App Script (Google Sheets)
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 {Integer} width - Integer indicating the width of your target render
// @param {Integer} height - Integer indicating the height of your target render
// @param {String} output - String specifying the output format, "image" or "json"
var token = 'Your API Key';
var url = encodeURIComponent('https://google.com');
var width = 1920;
var height = 1080;
var output = 'image';
// Construct the query params and URL
var query = "https://shot.screenshotapi.net/screenshot";
query += `?token=${token}&url=${url}&width=${width}&height=${height}&output=${output}`;
// Call the API and save the screenshot
request.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!");
}
});
});
// @param {String} $token - String containing your API Key
// @param {String} $url - Encoded URI string container the URI you're targeting
// @param {Integer} $width - Integer indicating the width of your target render
// @param {Integer} $height - Integer indicating the height of your target render
// @param {String} $output - String specifying the output format, "image" or "json"
$token = 'Your API Key';
$url = urlencode('https://google.com');
$width = 1920;
$height = 1080;
$output = 'image';
// Construct the query params and URL
$query = "https://shot.screenshotapi.net/screenshot";
$query .= "?token=$token&url=$url&width=$width&height=$height&output=$output";
// Call the API
$image = file_get_contents($query);
// Save the screenshot
file_put_contents('./screenshot.png', $image);
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
url2 "net/url"
"os"
)
func main() {
// @param {String} token - String containing your API Key
// @param {String} url - Encoded URI string container the URI you're targeting
// @param {Integer} width - Integer indicating the width of your target render
// @param {Integer} height - Integer indicating the height of your target render
// @param {String} output - String specifying the output format, "image" or "json"
token := "Your API Key"
url := url2.QueryEscape("https://google.com")
width := 1920
height := 1080
output := "image"
// Construct the query params and URL
query := "https://shot.screenshotapi.net/screenshot"
query += fmt.Sprintf("?token=%s&url=%s&width=%d&height=%d&output=%s",
token, url, width, height, output)
// Call the API
resp, err := http.Get(query)
if err != nil {
panic(err)
}
defer resp.Body.Close()
// Raise error if call was unsucessfull
if resp.StatusCode != 200 {
errorBody, _ := ioutil.ReadAll(resp.Body)
panic(fmt.Errorf("error while calling api %s", errorBody))
}
// Save the screenshot
file, err := os.Create("./screenshot.png")
if err != nil {
panic(err)
}
defer file.Close()
_, err = io.Copy(file, resp.Body)
if err != nil {
panic(err)
}
}
package main;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
public class Main {
public static void main(String[] args) {
try {
// @param {String} $token - String containing your API Key
// @param {String} $url - Encoded URI string container the URI you're targeting
// @param {Integer} $width - Integer indicating the width of your target render
// @param {Integer} $height - Integer indicating the height of your target render
// @param {String} $output - String specifying the output format, "image" or "json"
String token = "Your API Key";
String url = URLEncoder.encode("https://google.com");
int width = 1920;
int height = 1080;
String output = "image";
// Construct the query params and URL
String query = "https://shot.screenshotapi.net/screenshot";
query += String.format("?token=%s&url=%s&width=%d&height=%d&output=%s",
token, url, width, height, output);
URL apiUrl = new URL(query);
// Call the API and save the screenshot
InputStream inputStream = apiUrl.openStream();
OutputStream outputStream = new FileOutputStream("./screenshot.png");
inputStream.transferTo(outputStream);
inputStream.close();
outputStream.close();
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
import urllib.parse
import urllib.request
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
# @param {String} $token - String containing your API Key
# @param {String} $url - Encoded URI string container the URI you're targeting
# @param {Integer} $width - Integer indicating the width of your target render
# @param {Integer} $height - Integer indicating the height of your target render
# @param {String} $output - String specifying the output format, "image" or "json"
token = "Your API Key"
url = urllib.parse.quote_plus("https://google.com")
width = 1920
height = 1080
output = "image"
# Construct the query params and URL
query = "https://shot.screenshotapi.net/screenshot"
query += "?token=%s&url=%s&width=%d&height=%d&output=%s" % (token, url, width, height, output)
# Call the API
urllib.request.urlretrieve(query, "./screenshot.png")
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://shot.screenshotapi.net/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
/**
* Takes a website URL as input and returns a screenshot of the website using the ScreenshotAPI service.
* @param {string} websiteUrl - The URL of the website to take a screenshot of.
* @return {string} screenshotUrl - The URL of the screenshot image.
* @customfunction
*/
async function SCREENSHOT(websiteUrl) {
const YOUR_API_KEY = "XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX"; // Your ScreenshotAPI API key
const query = `https://shot.screenshotapi.net/screenshot?token=${YOUR_API_KEY}&url=${websiteUrl}&output=image&file_type=png&wait_for_event=load`; // Construct the query params and URL
const options = {
'method' : 'get',
'contentType': 'application/json',
'followRedirects':false
}; // The options for the fetch request
const response = await UrlFetchApp.fetch(query,options); // Make the fetch request to ScreenshotAPI
const screenshotUrl = response.getHeaders()['Location']; // Get the URL of the screenshot from the response headers
return screenshotUrl; // Return the URL of the screenshot
}
We have a free proxy you can use if you need one: http://xo:[email protected]:3128
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 [email protected] or go to help.screenshotapi.net
Last modified 2mo ago