This is an outdated version of the Screenshot API. Please refer to Latest Version Documentation for the greatest functionality.

Introduction

Restpack Screenshot API is an easy to use RESTful web service that can capture screenshots of live web pages and deliver the results in several formats. The service sits on a fully functional browser rendering engine with rich html / css / js capabilities.

Authentication

With each API call, you must provide an authentication token. To create a new access token please refer to user tokens page on your account dashboard.

You can either provide the access token within the querystring or as a header.

  • If you wish to use the querystring method. Provide the token as access_token querystring parameter. As in https://restpack.io/api/screenshot/v2/capture?access_token={TOKEN}
  • In case you want to use a header, please provide the access token in X-Access-Token header.

Errors

Access token errors are represented in 4xx class HTTP errors.

  • 401 - in case no access token is provided.
  • 402 - when the account balance is not sufficient for this API call.
  • 403 - when the access token is not valid / revoked.

Endpoint

Capture and return a screenshot

In order to capture a screenshot, you simply need to invoke a GET request on the following URL. You can capture publicly accessible URL with GET Request, or Raw HTML string with POST Request.

GEThttps://restpack.io/api/screenshot/capture

Parameters

urlurl

The URL of web page, including the protocol that you want to capture.

Example: http://example.com
access_tokenstring

Your personal access token for API access.

Example: XXXXXXXX
formatenum

Preferred image output format.

Default: pngPattern: jpg | png | pdf
jsonboolean

Return a JSON response with the resulting image's URL instead of the image itself.

Default: false
widthinteger

Preferred viewport width in pixels.

Default: 1024Min: 10Max: 4096
heightinteger

Preferred viewport width in pixels. Requires `width` to be set.

Min: 10Max: 4096
thumbnail_widthinteger

In case you want a thumbnail image, provide a preferred width.

Min: 1Max: 1024
inject_cssstring

An external CSS file URL or Plain CSS to be injected into the page before render.

inject_jsstring

An external JS file URL or Plain CSS to be injected into the page before render.

delaynumber

Time in seconds to delay capture after page load.

Default: 2Max: 10
ttlnumber

Time in seconds for the resulting image to be cached for further requests.

Default: 86400 (1 day)Max: 2592000 (1 month)
freshboolean

Force rendering a new screenshot disregarding the cache status.

Default: false
shutter_elementstring

A CSS selector for the shutter element. Capturing will wait for this element to be found within document.

Example: body div.withclass
shutter_functionstring

A function name to be exported on the `window` object of target web page. Capturing will wait for this function to be called.

Example: captureSS
header_uastring

Custom user-agent header string for the web request.

Default: Chrome Compatible User Agent
header_langstring

Custom accept-language header string for the web request.

POSThttps://restpack.io/api/screenshot/capture

Parameters

html_datastring

Raw HTML string of a page that you want to capture.

Example: <html><body>....
access_tokenstring

Your personal access token for API access.

Example: XXXXXXXX
formatenum

Preferred image output format.

Default: pngPattern: jpg | png | pdf
jsonboolean

Return a JSON response with the resulting image's URL instead of the image itself.

Default: false
widthinteger

Preferred viewport width in pixels.

Default: 1024Min: 10Max: 4096
heightinteger

Preferred viewport width in pixels. Requires `width` to be set.

Min: 10Max: 4096
thumbnail_widthinteger

In case you want a thumbnail image, provide a preferred width.

Min: 1Max: 1024
inject_cssstring

An external CSS file URL or Plain CSS to be injected into the page before render.

inject_jsstring

An external JS file URL or Plain CSS to be injected into the page before render.

delaynumber

Time in seconds to delay capture after page load.

Default: 2Max: 10
ttlnumber

Time in seconds for the resulting image to be cached for further requests.

Default: 86400 (1 day)Max: 2592000 (1 month)
freshboolean

Force rendering a new screenshot disregarding the cache status.

Default: false
shutter_elementstring

A CSS selector for the shutter element. Capturing will wait for this element to be found within document.

Example: body div.withclass
shutter_functionstring

A function name to be exported on the `window` object of target web page. Capturing will wait for this function to be called.

Example: captureSS
header_uastring

Custom user-agent header string for the web request.

Default: Chrome Compatible User Agent
header_langstring

Custom accept-language header string for the web request.

Features

Thumbnails

The API will return a full size render by default. If you want to generate smaller thumbnail images, provide a thumbnail_width parameter.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', thumbnail_width: '250' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&thumbnail_width=250")
  .header("x-access-token", "TOKEN")
  .asString();

Full Page

This is the default operation mode of the API. You can control the width of captured viewport using width parameter. The engine will figure out the complete height of the page and return the entire screen capture.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', width: '1480' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=1480")
  .header("x-access-token", "TOKEN")
  .asString();

Viewport

In order to specify a strict viewport, provide a height parameter along with the width parameter. By default height is not set and weight is defined as 1024.

For example, if you wish to capture with an iPhone 6 viewport size, the width parameter should be set 375 and height 667. While using mobile viewports, don’t forget to also provide a user agent header.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', width: '375', height: '667' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&width=375&height=667")
  .header("x-access-token", "TOKEN")
  .asString();

Formats

ScreenshotPACK can generate JPG, PNG and PDF files. The default is PDF, which is rendered with intact text reporesentations and a compact format. The JPG output provides the smaller sizes but has a fixed 80% quality setting.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', format: 'png' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&format=png")
  .header("x-access-token", "TOKEN")
  .asString();

Delay

By default, capturing engine waits for the page load and then 2 more seconds for initial javascripts to settle their rendering. You can control this duration using delay parameter (in seconds) from instantaneous to 10 seconds.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', delay: '5' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&delay=5")
  .header("x-access-token", "TOKEN")
  .asString();

Shutter

In addition to a fixed delay setting, a shutter mechanism can be provided. In order to wait for an element to be visible in the page, provide shutter_element parameter with the global css selector for that element. If you need to have a more granular control of shutter, you can provide a shutter_function name. This will be a global function on the page’s window object. When called within the page, initiates the capturing process. If you are not in control o the target page, you can mix this with inject_js parameter to gain control.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', shutter_element: 'div.someclass' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&shutter_element=div.someclass")
  .header("x-access-token", "TOKEN")
  .asString();

TTL

The API caches captured screenshots up to a specified time period. If you request a screenshot of a previously cached web page, result will be provided from the cache. It is possible to control the duration of cache using ttl parameter (in seconds)

In addition to setting a ttl, it is possible to use fresh=true prameter to invalidate cache and capture a new screenshot.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: { url: 'http://google.com', ttl: '60' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&ttl=60")
  .header("x-access-token", "TOKEN")
  .asString();

Headers

While the service uses reasonable defaults for user agents and accept language headers, it is possible to customize these headers.

http GET 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es' \
  x-access-token:TOKENcurl --request GET \
  --url 'https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es' \
  --header 'x-access-token: TOKEN'var request = require("request");

var options = { method: 'GET',
  url: 'https://restpack.io/api/screenshot/capture',
  qs: 
   { url: 'http://google.com',
     header_ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3',
     header_lang: 'es' },
  headers: { 'x-access-token': 'TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es")

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)
request["x-access-token"] = 'TOKEN'

response = http.request(request)
puts response.read_bodyimport http.client

conn = http.client.HTTPSConnection("restpack.io")

headers = { 'x-access-token': "TOKEN" }

conn.request("GET", "/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-access-token", "TOKEN")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-access-token: TOKEN"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}var client = new RestClient("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es");
var request = new RestRequest(Method.GET);
request.AddHeader("x-access-token", "TOKEN");
IRestResponse response = client.Execute(request);HttpResponse<String> response = Unirest.get("https://restpack.io/api/screenshot/capture?url=http%3A%2F%2Fgoogle.com&header_ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_3)%20AppleWebKit%2F600.6.3%20(KHTML%2C%20like%20Gecko)%20Version%2F8.0.6%20Safari%2F600.6.3&header_lang=es")
  .header("x-access-token", "TOKEN")
  .asString();