Give it a try

Code Samples

We have example code to get you started in several different languages

const API_KEY = 'YOUR API KEY GOES HERE';
            
            var ScreenshotApi = require('screenshotapi'); // npm install screenshotapi --save
            
            var captureRequest = {
              url: 'http://www.amazon.com',
              webdriver: 'firefox',
              viewport: '1280x1024',
              fullpage: false,
              javascript: true
            };
            
            ScreenshotApi.getScreenshot(
              API_KEY,        // your api key
              captureRequest, // the site to capture and your settings
              './'            // local path to store the screenshot png
              )
              .then( (localFile) => {
                console.log(`Downloaded to ${localFile}`);
              })
              .catch( (err) => {
                console.error('Error capturing screenshot:', err);
              });
            
            
# pip install screenshotapi
            # full source code available at:
            # https://github.com/screenshotapi/screenshotapi-python
            import screenshotapi
            
            screenshotapi.get_screenshot(
                apikey='YOUR API KEY GOES HERE',
                capture_request = {
                    'url': 'http://www.amazon.com',
                    'viewport': '1200x800',
                    'fullpage': False,
                    'webdriver': 'firefox',
                    'javascript': True,
                    'fresh': False
                },
                save_path = './'
            )
            
#!/usr/bin/ruby
            #tested on ruby 2.3
            
            require "net/http"
            require "net/https"
            require "uri"
            require "json"
            
            API_KEY = "YOUR API KEY GOES HERE"
            
            def beginCapture(url,viewport,fullpage,webdriver,javascript)
                serverUrl = "https://api.screenshotapi.io/capture"
                puts "Sending request: #{serverUrl}"
                uri = URI.parse(serverUrl)
                https = Net::HTTP.new(uri.host,uri.port)
                https.use_ssl = true
                req = Net::HTTP::Post.new(serverUrl, initheader = {'apikey' => API_KEY})
                req.set_form_data({"url" => url, "viewport" => viewport, "fullpage" => fullpage, "webdriver" => webdriver, "javascript" => javascript})
            
                result = https.request(req)
                #{"status":"ready","key":"f469a4c54b4852b046c6f210935679ae"}
                json_results = JSON.parse(result.body)
                key = json_results["key"]
                puts "Capture request key is #{key}"
                return key
            end
            
            RetrieveResult = Struct.new(:success, :bytes)
            
            def tryRetrieve(key)
                serverUrl = "https://api.screenshotapi.io/retrieve?key=" + key
                puts "Trying to retrieve: " + serverUrl
            
                uri = URI.parse(serverUrl)
                https = Net::HTTP.new(uri.host,uri.port)
                https.use_ssl = true
                req = Net::HTTP::Get.new(serverUrl, initheader = {'apikey' => API_KEY})
                result = https.request(req)
                json_results = JSON.parse(result.body)
                #{ "status":"ready","imageUrl":"http://screenshotapi.s3.amazonaws.com/captures/f469a4c54b4852b046c6f210935679ae.png"}
                retResult =  RetrieveResult.new
            
                if json_results["status"] == "ready"
                    puts "Downloading image: " + json_results["imageUrl"]
                    retResult.success = true
                    image_result = Net::HTTP.get_response(URI.parse(json_results["imageUrl"]))
                    retResult.bytes =  image_result.body
                else
                    retResult.success = false
                end
            
                return retResult
            end
            
            
            key = beginCapture("http://www.amazon.com","1200x800","true","firefox","true")
            
            timeout = 30
            tCounter = 0
            tCountIncr = 3
            
            while true do
                retResult = tryRetrieve(key)
                if retResult.success
                    puts "Saving screenshot to downloaded_screenshot.png"
                    outfile = File.new('downloaded_screenshot.png', 'w')
                    outfile.puts(retResult.bytes)
                    outfile.close
                    break
                else
                    tCounter += tCountIncr
                    puts "Screenshot not yet ready.. waiting for: " + tCountIncr.to_s + " seconds."
                    sleep(tCountIncr)
                    if tCounter > timeout
                        puts "Timed out while trying to retrieve: " + key
                        break
                    end
                end
            end
            
using Newtonsoft.Json;
            using System;
            using System.Collections.Generic;
            using System.IO;
            using System.Net;
            using System.Net.Http;
            using System.Threading.Tasks;
            
            namespace ScreenshotAPITest
            {
                class Program
                {
                    static void Main(string[] args)
                    {
                        var beginCaptureTask = BeginCapture("www.amazon.com", "1200x800", "true", "firefox", "true");
                        string key = beginCaptureTask.Result;
            
                        if(key == null)
                        {
                            Console.WriteLine("No Key returned, make sure you specified the correct API_KEY");
                            return;
                        }
                        
                        string key = BeginCapture("http://www.amazon.com", "1200x800", "true", "firefox", "true");
                        int timeout = 30;
                        int tCounter = 0;
                        int tCountIncr = 3;
            
                        while (true)
                        {
                            var tryRetrieveTask = TryRetrieve(key);
                            var result = tryRetrieveTask.Result;
            
                            if (result.Success)
                            {
                                Console.WriteLine("downloaded screenshot for key: " + key);
                                File.WriteAllBytes("downloaded_screenshot.png", result.Bytes);
                                break;
                            }
            
                            tCounter += tCountIncr;
                            System.Threading.Thread.Sleep(tCountIncr * 1000);
                            Console.WriteLine("Screenshot not yet ready.. waiting for: " + tCountIncr.ToString() + " seconds.");
            
                            if (tCounter > timeout)
                            {
                                Console.WriteLine("timed out while downloading: " + key + " " + DateTime.Now.ToShortTimeString());
                                break;
                            }
                        }
            
                    }
                
                    public class RetrieveResult
                    {
                        public bool Success { get; set; }
                        public byte[] Bytes { get; set; }
                    }
            
                    const string API_KEY = "YOUR API KEY GOES HERE";
            
                    public static async Task TryRetrieve(string key)
                    {
                        using (var httpClient = new HttpClient())
                        {
                            httpClient.DefaultRequestHeaders.Add("apikey", API_KEY);
                            string serverUrl = "https://api.screenshotapi.io/retrieve?key=" + key;
                            Console.WriteLine("Downloading:" + serverUrl);
                            var response = await httpClient.GetAsync(serverUrl).ConfigureAwait(false);
                            if (response.StatusCode == HttpStatusCode.OK)
                            {
                                var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                var jsonResults = JsonConvert.DeserializeObject(result);
            
                                RetrieveResult retResult = new RetrieveResult();
                                //{ "status":"ready","imageUrl":"http://screenshotapi.s3.amazonaws.com/captures/f469a4c54b4852b046c6f210935679ae.png"}
                                if (jsonResults.status == "ready")
                                {
                                    retResult.Success = true;
                                    WebClient client = new WebClient();
                                    string downloadUrl = jsonResults.imageUrl;
                                    retResult.Bytes = client.DownloadData(downloadUrl);
                                }
                                else
                                {
                                    retResult.Success = false;
                                }
                                return retResult;
                            }
                            else
                            {
                                Console.WriteLine("Invalid Status Received:" + response.StatusCode);
                            }
                        }
            
                        return null;
                    }
            
            
                    public static async Task BeginCapture(string url, string viewport, string fullpage, string webdriver, string javascript)
                    {
                        using (var httpClient = new HttpClient())
                        {
                            httpClient.DefaultRequestHeaders.Add("apikey", API_KEY);
                            var serverUrl = "https://api.screenshotapi.io/capture"; 
            
                            var formContent = new FormUrlEncodedContent(new[]
                            {
                                new KeyValuePair("url",  WebUtility.UrlEncode(url)),
                                new KeyValuePair("viewport",  viewport),
                                new KeyValuePair("fullpage",  fullpage),
                                new KeyValuePair("webdriver",  webdriver),
                                new KeyValuePair("javascript",  javascript)
                            });
            
            
                            var response = await httpClient.PostAsync(serverUrl, formContent).ConfigureAwait(false);
                            if (response.StatusCode == HttpStatusCode.Accepted || response.StatusCode == HttpStatusCode.OK)
                            {
                                var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
                                var jsonResults = JsonConvert.DeserializeObject(result);
                                string key = jsonResults.key;
                                Console.WriteLine(key);
                                return key;
                            }
                            else
                            {
                                Console.WriteLine("Invalid Status Received:" + response.StatusCode);
                            }
                        }
                        return null;
                    }
            
                }
            }
            

Highly Customizable

To provide the highest quality screenshots possible, we use the latest versions of FireFox and Chrome and allow you to manipulate Javascript.

Choose Your Browser

Specify if screenshots should be taken with Firefox or Chrome. Optionally set the Useragent as well.

Toggle Javascript

Optionally turn Javascript off to prevent popups from covering the page.

Set Viewport and Fullpage Mode

Take full page or above the fold screenshots, set the viewport for responsive viewing.

Contact Us

Have a question? Reach out to us for any reason.