# API Features

## Full-Height Captures

By default, screenshots are rendered based on the height of the selected (or default) viewport. Alternatively, you can request the full height of the target website to be captured, simply by setting the API's fullpage parameter to 1.

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.cnn.com
    & fullpage = 1
```

## Thumbnails

By default, the screenshotlayer API returns a snapshot of your target website at its original size (1:1). If you'd like to request a thumbnail, append the API's width parameter with your preferred thumbnail width in pixels.

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.facebook.com
    & width = 350
```

## Viewport Control

The screenshotlayer API's default viewport setting is 1440x900. You can specify a custom viewport by setting the viewport parameter to your desired dimensions. (format: width x height, in pixels)

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & user_agent = Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4&viewport=375x667   
    & viewport = 375x667
```

> **Important:** When requesting mobile-sized viewports (example above), it is highly recommended to also specify a user\_agent parameter, as some websites (e.g. google.com) tend to ignore mobile viewports that come without specified HTTP User-Agent headers (See [User-Agent parameter](https://docs.apilayer.com/screenshotlayer/docs/api-features?preview=product#http-user-agent-headers)).

Find below a list of the most commonly used viewport sizes:

**Common Viewports:**

| Device | Viewport |
| --- | --- |
| iPhone 4 (s) | 320x480 |
| iPhone 5 (c/s) | 320x568 |
| iPhone 6 | 375x667 |
| iPhone 6 Plus | 414x736 |
| iPad (2/Mini/Retina) | 1024x768 |
| Samsung Galaxy S3, S4, S5 | 360x640 |
| Macbook 13" | 1440x900 |
| iMac 27" | 2560x1440 |

> You can find a comprehensive [list of mobile viewport sizes here](http://viewportsizes.com/).

## Output Formats

Your snapshots can be requested in three different formats: `PNG`, `JPG` and `GIF`. You can change the default format (PNG) by simply appending the API's format parameter with your preferred format.

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.cnn.com
    & format = JPG
```

**Please Note:** Output formats are not case sensitive, and appending "JPEG" is just as valid "JPG".

## URL Encryption

For those of you who have to display API request URLs on your website (e.g. inside an <img src="..."> tag, it is crucial to make use of the screenshotlayer API's URL Encryption method, which lets you generate a unique Secret Key for every API request and simply append it to the respective query URL.

In order to prevent your publicly displayed API request URL from being abused, you need to follow these steps:

**Step 1: Define your target website's URL**

First of all, define the URL of the website you want to take a snapshot of.

In our example, we will use the following URL:

```javascript
http://www.apple.com        
```

**Step 2: Define your secret keyword**

A secret keyword can be any secret word or phrase of your choice. As the next step, make sure you have defined it in your account dashboard. If not, you can simply [add a secret keyword here.](https://screenshotlayer.com/login/?utm_source=DocumentationPage&utm_medium=Referral)

In our example, we will use the following secret keyword:

```javascript
mysecretkeyword
```

**Step 3: Combine**

Now you will need to combine these two parts (URL & secret keyword) into one, resulting in:

```javascript
http://www.apple.commysecretkeyword
```

**Step 4: Generate your md5 Secret Key**

Finally, create an md5 hash of the combined parts. (this will be your secret\_key)

```javascript
a9d09c5b1cda7e5ef51fed4526e9cff3
```

Now that you have your Secret Key, you can simply append to your query URL using the API's secret\_key parameter and rest assured that your API access is - as long as you'll keep your secret keyword secret - safe from abuse.

**Syntax:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.apple.com
    & secret_key = a9d09c5b1cda7e5ef51fed4526e9cff3
```

## CSS Injection

The Screenshotlayer API enables you to inject a custom CSS stylesheet into the target website by appending an existing CSS file URL to the API's css\_url parameter.

For our example, we have prepared a file called css\_inject.css, containing the following CSS declaration:

```javascript
body {
background: #00ff00 !important;
}       
```

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.youtube.com
    & css_url = https://screenshotlayer.com/downloads/css_inject.css
```

> **Please Note:** Attached CSS files must not exceed a file size of 100kB (around 100,000 characters).

## Capturing Delay

The API's delay parameter enables you to specify a custom delay time (in seconds) before the snapshot is captured. This feature may especially useful if certain contents of your target website appear after the initial page load. (e.g. CSS animations, JavaScript effects)

**Example query:**

The following query sets a 3-second delay to capture any delayed/animated content on the target website. (*http://tumblr.com*)

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & delay = 3
```

> **Please Note:** The maximum supported delay time is 20 seconds.

## TTL (Caching Time)

By default, website screenshots are cached for 30 days (2,592,000 seconds). Using the API's ttl parameter, you can specify a custom caching time (time-to-live) lower than the default setting.

**Example query:**

The following query requests the snapshot's ttl to be set to 259,200 seconds (3 days).

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & ttl = 259200 
```

> **Please Note:** The default ttl (30 days, or 2,592,000 seconds) is the maximum supported caching time.

## Force Refresh

You can easily force the API to capture a fresh screenshot of the requested target URL by appending the force parameter to the request URL and setting it to 1.

**Example query:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & force = 1
```

## Placeholder image

For the very few seconds a freshly captured screenshot loads, there are two options for requesting a placeholder image:

### **Option 1: Using the default placeholder**

By appending the API's placeholder parameter and setting it to 1, you can request the default screenshotlayer placeholder image, which looks like this:

![default placeholder image](https://screenshotlayer.com/images/assets/placeholder.png)

### **Option 2: Setting a custom placeholder image URL**

If you prefer setting your own custom placeholder image, simply append it to the API's placeholder parameter as an image URL.

Supported file formats: PNG, JPEG, GIF

**Example query: (using option 1)**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.twitter.com
    & placeholder = 1
```

> **Please Note:** If activated, placeholder images are returned immediately after the API request and remain visible until the respective page is refreshed.

## Retina/2× Resolution Support

Modern screens — especially on mobile devices and Apple hardware — have very high pixel densities. A screenshot that looks sharp on a regular monitor can appear blurry on a Retina/HiDPI display.

With the **Retina/2× resolution** option, users will be able to generate images that:

-   Appear crisp on modern devices
-   They are suitable for embedding in high-end web apps or reports
-   Can be printed or zoomed without quality loss

### API Parameter

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| scale | float (e.g., 1, 1.5, 2) | 1 | Determines device pixel ratio for rendering. Use 2 for Retina. |

**Example API call:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = https://example.com&scale=2
```

**API Example: Full Request (Retina):**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = https://apple.com
    &fullpage=1
    &format=png
    &scale=2
```

## WebP Format Support

Screenshotlayer now supports generating screenshots in `**WebP**`, a modern image format developed by Google. `**WebP**` provides smaller file sizes while maintaining high visual quality, making it an excellent choice for web performance optimization.

-   **Smaller file sizes:** 25–35% reduction compared to PNG and JPEG.
-   **Transparency support:** Like PNG.
-   **Efficient compression:** Like JPEG.
-   **Broad browser compatibility:** Supported in ~95% of browsers worldwide, including Chrome, Edge, Firefox, and Safari.

### Feature Specification

**New API Parameter**

| Parameter | Type | Accepted Values | Default | Description |
| --- | --- | --- | --- | --- |
| format | string | png, jpg, gif, webp | png | Defines output file format |
| quality (optional; only applies to lossy formats like jpg/webp) | integer | 1-100 | 70 | Defines the quality for the output |

***NOTE:*** 

-   ***Free Plans:** WebP quality supports up to 70 by default.*
    
-   ***Paid Plans:** WebP quality supports up to 70 by default, up to 100 with a customized quality parameter.*
    

**Example API call:**

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_KEY
    & url = https://example.com&format=webp
```

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_KEY
    & url = https://example.com&format=webp&quality=80
```

## HTTP User-Agent Headers

By default, the screenshotlayer API does not send any HTTP User-Agent headers with your request. You can specify a custom user-agent string by appending it to the API's user\_agent parameter.

**Example query:**

The following query requests a screenshot of *http://facebook.com* on mobile Safari (iOS 8.0.2, iPhone):

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.facebook.com
    & viewport = 375x667
    & user_agent = Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4   
```

**Common User-Agent Strings:**

| System | UA String |
| --- | --- |
| Chrome Generic Win7 64-bit | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 |
| Chrome Generic MacOSX | Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_10\_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 |
| Safari 8.0 MacOSX | 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 |
| Firefox Generic Win7 64-bit | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0 |

You can find a [full list of user-agent strings here.](http://www.useragentstring.com/pages/useragentstring.php)

## HTTP Accept-Language Headers

The default HTTP Accept-Language header is en-US, en (US English, or English in general). You can specify a custom Accept-Language header by appending it to the API's accept\_lang parameter.

**Example query:**

The following query requests a screenshot of *http://facebook.com* in Spanish:

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.facebook.com
    & accept_lang = es            
```

You may also specify several different languages at once. Each additional language is separated by a comma. The order in which the values appear in the header determines the hierarchy of importance.

In the following example,e es-MX (Spanish, Mexico) is the highest priority, followed by general Spanish and general English:

```javascript
es-MX,es,en           
```

**Common Accept-Language Strings:**

| Language | Accept-Language |
| --- | --- |
| English (general) | en |
| German | de |
| Spanish | es |
| Italian | it |
| English (US) | en-US |
| English (UK) | en-GR |
| Spanish (Spain) | es-ES |
| Spanish (Mexico) | es-MX |

> You can find a comprehensive [list of accept-language strings here.](http://www.metamodpro.com/browser-language-codes)

## Export to AWS S3

If you are subscribed to the Professional or Enterprise Plan, you may request the API to export your snapshot to your AWS S3 Bucket directly. This can be done simply by appending your S3 Bucket path (format: s3://API\_KEY:API\_SECRET@bucket) to the API's export parameter.

**Example query:**

Find below an example query requesting the API to export a screenshot of *http://tumblr.com* directly to a specified AWS S3 Bucket.

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & export = s3://DHSJ2HDGALIIDHSJDGAH:7SH6s7Sw9DKSH7h8Zs9Bw9DKSSH7h86s7Sw9Bw9D@mybucket.test/path/to            
```

> **Important:** Uploading your snapshot to the given S3 path may take up to 1 minute to complete. Please be aware that our system can only attempt accessing the specified export path and cannot notify you in case your upload fails.

## Export to FTP

Professional and Enterprise Customers may also specify a custom ftp path to directly export captured snapshots to. This can be achieved simply by appending your desired FTP path (format: ftp://user:password@server) to the API's export parameter.

**Example query:**

Find below an example query requesting the API to export a screenshot of *http://tumblr.com* directly to a specified FTP path.

```javascript
http://api.screenshotlayer.com/api/capture
    ? access_key = YOUR_ACCESS_KEY
    & url = http://www.tumblr.com
    & export = ftp://myusername:mypassword@123.12.12.1/path/to      
```

> **Important:** Uploading your snapshot to the given FTP path may take up to 1 minute to complete. Please be aware that our system can only attempt accessing the specified export path and cannot notify you in case your upload fails.

[← Playground](https://docs.apilayer.com/screenshotlayer/docs/playground)

[Language Examples →](https://docs.apilayer.com/screenshotlayer/docs/language-examples)

* * *

Chat with APILayer´s team on [Discord](https://discord.com/invite/hgjA78638n).

Questions? [Contact Sales](https://screenshotlayer.com/contact) .

Need help? [Contact Support](https://screenshotlayer.com/contact) .

© 2026 APILayer. All rights reserved.
