Contents
Our Documentation
Getting Started
To create a screenshot send a GET
or POST
request
to this endpoint.
https://screenshotapi.net/api/v1/screenshot
Example
To make a screenshot of medium.com add the url
parameter to the request.
https://screenshotapi.net/api/v1/screenshot?url=medium.com
Authentication
Add the token
parameter with your API token to the request to authorize yourself.
https://screenshotapi.net/api/v1/screenshot
?url=medium.com
&token=YOUR_API_TOKEN
Parameters
This is a list of all parameters that you can add to the request.
Note that parameters should be URL encoded when sending a GET
request.
Parameter | Type | Default value | Description |
---|---|---|---|
token |
string |
'' |
Your API token. |
url |
string |
'' |
The url of the website. |
custom_html |
string |
'' |
You can also provide your own html that should be rendered. If this is the case the url field is not required. |
width |
int |
1680 |
The width of the browser in pixels. |
height |
int |
876 |
The height of the browser in pixels. |
retina |
boolean |
false |
This will set the device scale factor to 2 , producing a high resolution retina screenshot.Available for the Startup and Business plans |
full_page |
boolean |
false |
If true a screenshot of the entire webpage will be made. |
lazy_load |
boolean |
false |
If true the browser will scroll down the entire page so that all content is loaded. |
fresh |
boolean |
false |
If true this will force a fresh screenshot (instead of a cached screenshot). |
output |
string |
'json' |
You can select json as output, or the raw image by setting it to image . |
thumbnail_width |
int |
null |
The width of the output image, the aspect ratio will be preserved. If not set then the browser width is used. |
delay |
int |
0 |
How many milliseconds to wait before taking the screenshot. |
accept_languages |
string |
'en-US,en;q=0.8' |
The accept languages header to set. |
user_agent |
string |
'' |
The user agent string to set. |
ttl |
int |
2592000 |
How many seconds the screenshot should be cached. Default is 30 days. |
css_url |
string |
'' |
A specific CSS stylesheet URL to inject in the page. |
css |
string |
'' |
CSS code to inject in the page. |
selector |
string |
'' |
A Selector that will search for a DOM element. If the element is found a screenshot of that element is returned.
Example: div > .main-navigation > .logo
|
scroll_to_element |
string |
'' |
A selector of a DOM element. The browser will scroll to this selected element. Useful if the element is only loaded if it is in the viewport.
Example: div > .main-navigation > .logo
|
cookies |
string |
'' |
The cookies to set in the browser. If sending multiple cookies use a ; to seperate them.
For example: cookie1=myValue;cookie2=myOtherValue
|
headers |
string |
'' |
The headers to add to the request. If sending multiple use a ; to seperate them.
For example: X-MY-HEADER-1: myValue;X-MY-HEADER-2: myOtherValue
|
block_ads |
boolean |
false |
If true advertisements will be blocked. Available for the Essentials, Startup and Business plans |
no_cookie_banners |
boolean |
false |
If true cookie banners will not be displayed. Available for the Essentials, Startup and Business plans |
proxy |
string |
'' |
Connect to a custom proxy. You should use the following format:
address:port or username:[email protected]:port
|
latitude |
number |
null |
Latitude used to emulate the Geolocation API. Use a value between -90 and 90
|
longitude |
number |
null |
Longitude used to emulate the Geolocation API. Use a value between -180 and 180
|
fail_on_error |
boolean |
false |
If true the the API will return an error if it encounters a 4xx or 5xx status code.
|
destroy_screenshot |
boolean |
false |
If true the screenshot is not stored on our servers. This means that you must download the image because it is only available once after you've called the API. |
Errors
If the API encounters an error a 4xx
or 5xx
status code along with the error message is returned.
This is an example of 2 error messages that are returend for the width
and full_page
parameters.
{
errors: {
width: [
"The width must be between 32 and 3840."
],
full_page: [
"The full_page parameter must be either true or false."
]
}
}
Quota
With each API call the following quota headers are sent.
Header | Description |
---|---|
X-Quota-Limit |
The total number of screenshots you can take per month |
X-Quota-Remaining |
The number of screenshots you can still make this month |
X-Quota-Reset-At |
A unix timestamp of when the quota resets (the first of each month) |
Query builder
Use our query builder to explore our API.
(If you are logged in your API token is automatically added)
Code Examples
These code examples show how to save a website screenshot to a file.