Skip to content
For developers

Website screenshot API

Send the address of a web page and get an image back. The whole page or only the first screen, as on a desktop or a phone.

Each capture costs 1 credit.

# API key: switchfile.io/dashboard/keys. The answer is the capture as JSON;
# result.file.url is the download link, valid for 24 hours.
curl "https://api.switchfile.io/v1/captures?wait=30" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","output_format":"png","options":{"device":"mobile"}}'



What comes back

The capture comes back as JSON, with the download link in result.file.url.

Every field of the answer is in the guide to website capture.
Without the wait parameter, the request answers at once with 202 and the capture keeps running. Fetch links.self later to get the result. Website capture in the docs.
No browser at hand? POST /v1/signup with an email address sends a code, and POST /v1/signup/verify with that code returns the key. Get an API key without a browser

What you get

Whole page or first screen

Without screen_height the whole page is captured. With it, only the window of that height.

Desktop or phone

device set to mobile uses a phone screen width with touch and the user agent of a phone browser.

Pages behind a login

Send the session as cookies or a token in headers. Both are stored encrypted and shown as [redacted] in responses.

Image formats

png can keep a transparent background. jpg and webp take a quality from 1 to 100. The pixel density is 2 by default.

Options

Send them in options as JSON. Options that do not fit the format are rejected with a message that names them.

Options for Website screenshot
OptionMeaning
devicedesktop (default) or mobile.
screen_widthWidth of the browser window in pixels, 1440 by default (390 for mobile).
screen_heightHeight of the window. Without it, the whole page is captured.
wait_for_elementCSS selector that must appear before the capture.
qualityQuality for jpg and webp, 1 to 100, 80 by default.
transparent_backgroundKeep a transparent page background in png and webp.
cookiesCookies for the site of url, as a list of name and value.
Every option of every format is in the list of capture options.

Where your files go

Captured on our server

Captures run on our server in the EU. Stored files and results are deleted after 24 hours. Hosting in the privacy policy

Data processing agreement

We sign a data processing agreement (DPA) under Art. 28 GDPR on request. Write to hello@switchfile.io. Security

Pricing

  • Free

    20files/day

    free API key

  • Credit pack

    from€7

    500 credits, one-time, no subscription

  • Monthly

    from€4

    500 credits a month, cancel at any time

Each capture costs 1 credit, however long the page takes to load.

A capture uses 1 credit, which costs €0.0043 to €0.014 depending on the plan or pack.

See all prices

SDKs and integrations

The examples use our official SDKs, and the PHP example needs only the curl extension. The SDK overview lists every client library and integration with its install line.

See the SDK overview

Questions

About Website screenshot through the API.

What are the limits?

A page has 30 seconds to load and may load up to 50 MB. A full-page image is cut at 20000 pixels in height (webp: 16383), and the notes of the result say so. Each API key can start 30 captures per minute with credits, and 5 without credits or with a sandbox key.

Can it capture pages behind a login?

Yes. Send the session as cookies or a token in headers. Both are stored encrypted and appear as [redacted] in every response and webhook. They are deleted when the job finishes, or after 24 hours if it fails.

Does JavaScript run?

Yes. The page is loaded like a normal browser visit from our servers, with JavaScript on.

Can every website be captured?

No. The address must be reachable from the internet, and private networks are blocked. Websites that block automated visitors cannot be captured. For a check that finishes on its own we wait a few seconds; we never solve captchas.

How long do you keep my files?

The result is kept for 24 hours, then it is deleted. You can delete it earlier through the API.

Try it with your own files

Each capture costs 1 credit. Other tasks for the same API key are on the overview of use cases.