GET
/
v1
/
screenshots
/
take
Typescript (SDK)
import { Screenshothis } from "@screenshothis/sdk";

const screenshothis = new Screenshothis();

async function run() {
  const result = await screenshothis.screenshots.take({
    apiKey: "sk_live_abcdef1234567890abcdef1234567890",
    url: "https://example.com",
    selector: ".main-content",
    blockRequests: "*.doubleclick.net\n" +
    "*.googletagmanager.com\n" +
    "*/analytics/*",
    blockResources: [
      "script",
      "stylesheet",
      "font",
    ],
    cacheKey: "homepage-desktop-light",
    headers: "User-Agent: MyBot/1.0\n" +
    "Authorization: Bearer token123\n" +
    "X-Custom-Header: value",
    cookies: "session_id=abc123; Domain=example.com; Path=/; Secure\n" +
    "user_pref=dark_mode; Max-Age=3600",
  });

  console.log(result);
}

run();
This response does not have an example.

Query Parameters

api_key
string
required

API key used to authenticate the request. Must be at least 32 characters long.

Minimum length: 32
Example:

"sk_live_abcdef1234567890abcdef1234567890"

url
string
required

Target URL of the website to capture. Must be a valid HTTP or HTTPS URL.

Example:

"https://example.com"

selector
string | null

CSS selector to capture a specific element instead of the full page. If provided, only the matching element will be screenshotted.

Example:

".main-content"

width
number | null
default:1920

Width of the viewport in pixels for the screenshot

Required range: 1 <= x <= 7680
Example:

1920

height
number | null
default:1080

Height of the viewport in pixels for the screenshot

Required range: 1 <= x <= 4320
Example:

1080

is_mobile
boolean | null
default:false

Enable mobile device emulation with touch events and mobile user agent

Example:

false

is_landscape
boolean | null
default:false

Set device orientation to landscape mode when mobile emulation is enabled

Example:

false

has_touch
boolean | null
default:false

Enable touch event support for the emulated device

Example:

false

device_scale_factor
number | null
default:1

Device pixel ratio for high-DPI displays. Higher values produce sharper images on retina displays.

Required range: 0.1 <= x <= 3
Example:

1

format
enum<string>
default:jpeg

Output image format. JPEG offers smaller file sizes, PNG supports transparency, WebP provides modern compression.

Available options:
jpeg,
png,
webp
Example:

"jpeg"

quality
number
default:80

Image compression quality from 20 (lowest/smallest) to 100 (highest/largest). Only applies to JPEG and WebP formats.

Required range: 20 <= x <= 100
Example:

80

block_ads
boolean | null
default:false

Block advertisements and ad-related content from loading during screenshot capture

Example:

false

Automatically hide cookie consent banners and GDPR notices for cleaner screenshots

Example:

false

block_trackers
boolean | null
default:false

Block tracking scripts and analytics to improve page load speed and privacy

Example:

false

block_requests
string

Newline-separated list of URL patterns to block during page load. Supports wildcards and regex patterns.

Example:

"*.doubleclick.net\n*.googletagmanager.com\n*/analytics/*"

block_resources
enum<string>[]

Array of resource types to prevent from loading. Useful for faster page loads and cleaner screenshots.

Example:
["script", "stylesheet", "font"]
prefers_color_scheme
enum<string>
default:light

Set the preferred color scheme for websites that support dark/light mode theming

Available options:
light,
dark
Example:

"light"

prefers_reduced_motion
enum<string>
default:no-preference

Accessibility setting to reduce animations and transitions for motion-sensitive users

Available options:
no-preference,
reduce
Example:

"no-preference"

is_cached
boolean | null
default:false

Whether to use cached version of the screenshot if available, or force a fresh capture

Example:

false

cache_ttl
number
default:3600

Cache expiration time in seconds. Minimum 1 hour (3600), maximum 1 year (31622400)

Required range: 3600 <= x <= 31622400
Example:

3600

cache_key
string

Custom cache key for grouping related screenshots. Auto-generated if not provided.

Example:

"homepage-desktop-light"

headers
string

Custom HTTP headers to send with the request in 'Name: Value' format, one per line. Maximum 8KB total size.

Maximum length: 8192
Example:

"User-Agent: MyBot/1.0\nAuthorization: Bearer token123\nX-Custom-Header: value"

cookies
string

Cookies to set before capturing the screenshot using Set-Cookie syntax (name=value; attributes), one per line. Maximum 4KB total size.

Maximum length: 4096
Example:

"session_id=abc123; Domain=example.com; Path=/; Secure\nuser_pref=dark_mode; Max-Age=3600"

bypass_csp
boolean | null
default:false

Bypass Content Security Policy restrictions that might prevent proper page rendering or script execution

Example:

false

Response

200
image/jpeg

Optimized screenshot response with enhanced CDN support

The response is of type file.