ApiFlash is a simple yet powerful screenshot API that any modern company can easily use to make pixel perfect website screenshots at scale. An up to date version of Chrome is used to ensure that all modern web features are fully supported and that rendering is exactly as you would expect. It's also built over AWS Lambda to make sure that it truly scales and keeps being stable under heavy workloads.
We're one of the most cost efficient screenshot API out there and we are dedicated to provide an awesome service to all companies, big or small.
Content-Type and Content-Length headers.
If the response_type parameter is set to json, then the response
contains a JSON document with links to the resulting screenshot.
| Parameter | Default | Description | ||
|---|---|---|---|---|
| access_key required | A valid access key allowing you to make API calls. Access keys can be managed from your dashboard. | |||
| url required | The complete URL of the website for which you want to capture a screenshot. It should be URL encoded and must include the protocol (http:// or https://) to be processed correctly. |
|||
| format |
defaults to
jpeg
|
The image format of the captured screenshot. Either jpeg, png or webp. The webp format is limited to 16350 pixels in width and in height, once the scale_factor is applied. |
||
| width in pixels |
defaults to
1920
|
The width, in pixels, of the viewport to use. From 0 to 16350 pixels, provided that width multiplied by height does not exceed 33177600 pixels. | ||
| height in pixels |
defaults to
1080
|
The height, in pixels, of the viewport to use. This is ignored if full_page is true. From 0 to 16350 pixels, provided that width multiplied by height does not exceed 33177600 pixels. |
||
| fresh |
defaults to
false
|
Force the API to capture a fresh new screenshot instead of returning a screenshot from the cache. | ||
| full_page |
defaults to
false
|
Set this parameter to true to capture the entire page of the target website. |
||
| quality |
defaults to
90
|
The quality of the image between 0 and 100. This works with the jpeg and webp formats. |
||
| delay in seconds |
defaults to
0
|
When possible, consider using the wait_for or the wait_until parameter instead as they provide more reliable ways to ensure the page is properly rendered before capture. The delay, in seconds, to wait after the page is loaded before capturing the screenshot. From 0 seconds to a maximum of 10 seconds. | ||
| scroll_page |
defaults to
false
|
Set this parameter to true to scroll through the entire page before capturing a screenshot. This is useful to trigger animations or lazy loaded elements. |
||
| ttl in seconds |
defaults to
86400
|
Number of seconds the screenshot is cached. API calls with the same parameters do return a cached screenshot and don't count in your monthly quota. From 0 seconds to 2592000 seconds (30 days). | ||
| response_type |
defaults to
image
|
The type of response to return. Can be either image or json.
|
||
| thumbnail_width | The width, in pixels, of the thumbnail to generate. The aspect ratio will be preserved. This is ignored if full_page is true. |
|||
| crop | Capture a screenshot of an area of the page. The area to capture is defined by a string of the form left,top,width,height. For example, the value 10,20,50,100 captures an area 50 pixels wide and 100 pixels high, with a 10 pixel offset from the left edge and a 20 pixel offset from the top edge. |
|||
| no_cookie_banners |
defaults to
false
|
Prevent cookie banners and popups from being displayed. | ||
| no_ads |
defaults to
false
|
Prevent ads from being displayed. Block requests from popular ad-networks and hide common ad spaces. | ||
| no_tracking |
defaults to
false
|
Prevent tracking scripts to run and block requests from popular tracking services. Use this to prevent page views to be incorrectly reported to tracking tools when screenshots are captured. | ||
| scale_factor |
defaults to
1
|
Specifies the device scale factor to use when capturing the screenshot. Acceptable values are 1 (standard resolution) and 2 (high definition for retina displays). A scale factor of 2 produces a high-definition screenshot but results in a heavier file size. |
||
| element | Capture a screenshot of the first element matched by the given CSS selector. This is ignored if full_page is true. The CSS selector should be URL encoded to be processed correctly. |
|||
| element_overlap |
defaults to
false
|
Also capture the elements that overlap the element targeted by the element parameter. | ||
| user_agent | Sets the User-Agent header to emulate a particular device when making screenshots. It should be URL encoded to be processed correctly. |
|||
| extract_html |
defaults to
false
|
Extract the HTML of the page at the same time the screenshot is made. This only works when the response_type parameter is set to json. When this parameter is set to true, an extracted_html attribute is added to the returned json document. |
||
| extract_text |
defaults to
false
|
Extract the text of the page at the same time the screenshot is made. This only works when the response_type parameter is set to json. When this parameter is set to true, an extracted_text attribute is added to the returned json document. |
||
| transparent |
defaults to
false
|
Capture a screenshot with transparency enabled. The background color of the page's body should be set to transparent for this to work. This only works with the png format. |
||
| wait_for | Wait until the provided CSS selector matches an element present in the page before capturing a screenshot. If no item matches after waiting 15 seconds, screenshot capture is aborted with an error. | |||
| wait_until |
defaults to
network_idle
|
Wait until the given criterion is satisfied to consider that the page has finished loading. The possible criteria are:
|
||
| wait_until_timeout |
defaults to
30
|
The maximum time, in seconds, to wait for the wait_until criterion to be satisfied. If the criterion is not satisfied within this time, the screenshot is captured anyway with whatever has been loaded so far. From 1 second to a maximum of 30 seconds. | ||
| fail_on_status | A comma separated list of HTTP status codes that should make the API call fail instead of returning a screenshot. Hyphen separated HTTP status codes can be used to define ranges. For example 400,404,500-511 would make the API call fail if the URL returns 400, 404 or any status code between 500 and 511. |
|||
| accept_language | Sets the Accept-Language header on requests to the target URL allowing you to make screenshots of a website with a specific language. |
|||
| css | A CSS string to inject in the web page when capturing the screenshot. This CSS string needs to be URL encoded to be processed correctly. | |||
| cookies | A semicolon separated list of cookies to be used when capturing the screenshot. Each cookie should be supplied as a name value pair and multiple pairs should be separated by a semicolon. The cookies parameter value should be URL encoded to be processed correctly. For example, cookie1=value1;cookie2=value2 would have to be URL encoded into cookie1%3Dvalue1%3Bcookie2%3Dvalue2. |
|||
| proxy | The address of a proxy server through which the screenshot should be captured. The proxy address should be formatted as address:port or user:password@address:port if authentication is needed. |
|||
| latitude | The latitude to use when emulating geo-location between -90 and 90. |
|||
| longitude | The longitude to use when emulating geo-location between -180 and 180. |
|||
| accuracy in meters |
defaults to
0
|
The accuracy value, in meters, to use when emulating geo-location. | ||
| js | Additional JavaScript code to be injected into the page before capturing. The JS string needs to be URL encoded to be processed correctly. | |||
| headers | A semicolon separated list of headers to be used when capturing the screenshot. Each header should be supplied as a key value pair and multiple pairs should be separated by a semicolon. The headers parameter value should be URL encoded to be processed correctly. For example, Header1=value1;Header2=value2 would have to be URL encoded into Header1%3Dvalue1%3BHeader2%3Dvalue2. |
|||
| time_zone | The time zone to use when capturing screenshots. This parameter accepts standard time zome database names. For example, Europe/Paris or America/New_York. It should be URL encoded to be processed correctly. |
|||
| ip_location | An ISO alpha-2 country code designating the country that should be associated with the IP address of the proxy through which the screenshot is captured. This feature is only available for custom enterprise plans. Get in touch with us if you need it. | |||
| s3_access_key_id | The AWS access key id to use to upload the screenshot to AWS S3. | |||
| s3_secret_key | The AWS secret access key to use to upload the screenshot to AWS S3. | |||
| s3_bucket | The name of the S3 bucket to upload the screenshot to. If you only use the screenshot uploaded to AWS S3 and don't use the screenshot returned in the HTTP response body, you might want to set the response_type to json to avoid unnecessary data transfer. |
|||
| s3_key | The object key to use when uploading the screenshot. | |||
| s3_endpoint | If you want to use a custom S3 compatible storage provider, you can specify the endpoint URL here. Leave this field empty to use AWS S3. | |||
| s3_region | The AWS region to use to upload the screenshot to AWS S3. You might need to set this if you use a custom S3 compatible storage provider. |
Please try again with a different search query.
screenshot.jpeg
file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | using System.Net; public class ApiFlashExample { private const string ApiFlashEndpoint = "https://api.apiflash.com/v1/urltoimage"; public static void Main () { using(var webClient = new WebClient()) { // The System.Web assembly reference is required. var parameters = System.Web.HttpUtility.ParseQueryString(string.Empty); parameters["access_key"] = "YOUR_ACCESS_KEY"; parameters["url"] = "https://example.com"; webClient.DownloadFile(ApiFlashEndpoint + "?" + parameters, "screenshot.jpeg"); } } } |
1 2 3 4 5 | endpoint="https://api.apiflash.com/v1/urltoimage" access_key="YOUR_ACCESS_KEY" url="https://example.com" curl --request GET --url "${endpoint}?access_key=${access_key}&url=${url}" > screenshot.jpeg |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | package main import ( "io" "net/http" "os" ) func main() { apiFlashEndpoint := "https://api.apiflash.com/v1/urltoimage" request, _ := http.NewRequest("GET", apiFlashEndpoint, nil) query := request.URL.Query() query.Add("access_key", "YOUR_ACCESS_KEY") query.Add("url", "https://example.com") request.URL.RawQuery = query.Encode() client := &http.Client{} response, _ := client.Do(request) defer response.Body.Close() image, _ := os.Create("screenshot.jpeg") io.Copy(image, response.Body) image.Close() } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; public class Main { private static String ACCESS_KEY = "YOUR_ACCESS_KEY"; private static String APIFLASH_ENDPOINT = "https://api.apiflash.com/v1/urltoimage"; public static void main(String[] args) throws Exception { String params = String.format("?access_key=%s&url=https://example.com", ACCESS_KEY); URL apiCallUrl = new URL(APIFLASH_ENDPOINT + params); InputStream inputStream = apiCallUrl.openStream(); OutputStream outputStream = new FileOutputStream("screenshot.jpeg"); byte[] b = new byte[2048]; int length; while ((length = inputStream.read(b)) != -1) { outputStream.write(b, 0, length); } inputStream.close(); outputStream.close(); } } |
1 2 3 4 5 6 7 8 9 | const https = require('https'); const fs = require('fs'); https.get("https://api.apiflash.com/v1/urltoimage?" + new URLSearchParams({ access_key: "YOUR_ACCESS_KEY", url: "https://example.com" }).toString(), (response) => { response.pipe(fs.createWriteStream('screenshot.jpeg')); }); |
1 2 3 4 5 6 7 8 9 10 11 | <?php $params = http_build_query(array( "access_key" => "YOUR_ACCESS_KEY", "url" => "https://example.com", )); $image_data = file_get_contents("https://api.apiflash.com/v1/urltoimage?" . $params); file_put_contents("screenshot.jpeg", $image_data); ?> |
1 2 3 4 5 6 | from urllib.parse import urlencode from urllib.request import urlretrieve params = urlencode(dict(access_key="YOUR_ACCESS_KEY", url="https://example.com")) urlretrieve("https://api.apiflash.com/v1/urltoimage?" + params, "screenshot.jpeg") |
1 2 3 4 5 6 7 | require "open-uri" File.open('screenshot.jpeg', 'wb') do |fo| params = URI.encode_www_form("access_key" => "YOUR_ACCESS_KEY", "url" => "https://example.com") fo.write open("https://api.apiflash.com/v1/urltoimage?" + params).read end |
429.
| Header Name | Description |
|---|---|
X-Quota-Limit |
The maximum number of API calls you can make per billing period. |
X-Quota-Remaining |
The number of API calls remaining for the current billing period. |
X-Quota-Reset |
The time, in UTC epoch seconds, at which the current billing period ends and the remaining number of API calls resets. |
1 2 3 4 5 | { "limit": 10000, "remaining": 5400, "reset": 1584549777 } |
| Status Code | Description |
|---|---|
400
Bad Request
|
Either the API call contains invalid parameters or the target URL cannot be captured. |
401
Unauthorized
|
The access key used to make this API call has been revoked or is invalid. |
402
Payment Required
|
The monthly screenshot quota has been exceeded for the user's current plan. |
403
Forbidden
|
The current plan does not support some of the features requested through API parameters. |
429
Too Many Requests
|
Too many API calls have been made. The specific reason is included in the response body. |
500
Internal Server Error
|
The screenshot capture failed because our API failed to handle the encountered situation. |
400, it also provides a meaningful
error message to help you understand the root cause of the error.
If the response_type parameter is set to json, an error type as well as
additional information might also be returned depending on the type of error.