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.
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.
output
is not set to json
), the options include PNG
, JPG
, WebP
, and PDF
. The default is PNG
false
.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
4xx
or 5xx
status code. Default is false
null
null
address:port
or username:[email protected]:port
. Default: ''
false
false
X-HEADER: value; X-OTHER_HEADERL otherValue;
. Default is ''
cookie=value;otherCookie=otherValue;
. Default is ''
''
div > .main-navigation > .logo
. Default is ''
''
''
2592000
seconds''
en-US,en;q=0.8
0
null
JSON
or the raw image captured. Default is image
false
true
, the browser will cross down the entire page to ensure all content is loaded in the render. Default is false
false
false
867
1680
''
output
is set to json
the following response will be given. Otherwise, output
is set to image
, the rendered image data will be returned.{screenshot "https://screenshotapi-dot-net.storage.googleapis.com/google_com_adcc8c63541a.png"url "https://google.com"output "json"file_type "png"}
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.
With each API call the following quota headers are sent.
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.
You can check out the Query Builder here: https://app.screenshotapi.net.
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 {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 URLvar query = "https://shot.screenshotapi.net/screenshot";query += `?token=${token}&url=${url}&width=${width}&height=${height}&output=${output}`;​// 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!");}});});​
// @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 screenshotfile_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 := 1920height := 1080output := "image"​// Construct the query params and URLquery := "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 APIresp, err := http.Get(query)if err != nil {panic(err)}defer resp.Body.Close()​// Raise error if call was unsucessfullif resp.StatusCode != 200 {errorBody, _ := ioutil.ReadAll(resp.Body)panic(fmt.Errorf("error while calling api %s", errorBody))}​// Save the screenshotfile, 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 URLString 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 screenshotInputStream inputStream = apiUrl.openStream();OutputStream outputStream = new FileOutputStream("./screenshot.png");inputStream.transferTo(outputStream);​inputStream.close();outputStream.close();} catch(Exception ex) {ex.printStackTrace();}}}​
import urllib.parseimport urllib.requestimport 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 = 1920height = 1080output = "image"​# Construct the query params and URLquery = "https://shot.screenshotapi.net/screenshot"query += "?token=%s&url=%s&width=%d&height=%d&output=%s" % (token, url, width, height, output)​# Call the APIurllib.request.urlretrieve(query, "./screenshot.png")​
​
At ScreenshotAPI we are there for you. We are developers ourselves and strive to ensure you have a great screenshot experience. If you need help at any point please contact us at [email protected] or use the chat bubble in the bottom right of your screen.
The ScreenshotAPI Team -- Andrew, Michael, Tom, and Henry