Skip to content
Screenshot API · Use case

Screenshot blocked websites without managing a proxy list

To screenshot blocked websites you need more than a headless browser: a challenge page, a 403 or an endless spinner is what bot protection serves to datacenter traffic. Price monitoring, competitive research, archiving and link previews all hit that wall sooner or later. Instead of buying and rotating proxies yourself, send the capture with your API key and the Screenshot API resolves the proxy for you, with no extra option.

The problem

A screenshot of a blocked website shows the bot wall, not the page

Datacenter IPs and headless fingerprints are exactly what antibot services look for. Cloudflare, DataDome, Akamai and similar shields answer with a challenge or a block, and your screenshot shows the wall instead of the page. With a self-hosted browser the navigation still succeeds, so nothing in your pipeline flags the image as useless.

Running your own proxies is a second product to maintain. You buy a pool, rotate exits, retire the burned ones, match the proxy type to each antibot vendor and keep the credentials out of your URLs and logs. The list that works this month stops working the next, and every failure looks like a blank capture.

With an API key the proxy is on by default, the free key included. When a capture hits a 403 wall, Microlink detects the antibot provider and escalates through proxy tiers, ending on residential exits: the slowest route, and the one that usually gets through. The tier that worked is cached per domain, so the next capture of that site goes straight to it. On the keyless endpoint the same target fails with EPROXYNEEDED instead.

How it works

How to screenshot a Cloudflare-protected site through the proxy

Send protected targets with your API key and the proxy resolves itself. If you start on the keyless endpoint, EPROXYNEEDED marks the URLs to move to the key. The proxy guide lists every signal that a target needs one.

1 · Capture with an API key
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot('https://hard-target.com')

The client carries your API key, so a blocked capture escalates through the proxy tiers on its own and returns the same asset object as any screenshot: url, width, height, type and size. There is no parameter to add, no list to maintain and no proxy credential in the request.

2 · Keyless first, API key when blocked
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const freeTier = createClient()

const capture = async target => {
  try {
    return await freeTier.screenshot(target)
  } catch (error) {
    if (error.code !== 'EPROXYNEEDED') throw error
    return microlink.screenshot(target, { retry: 3 })
  }
}

EPROXYNEEDED means the target uses antibot protection and needs an API key. Only those URLs move to the keyed client, where the proxy resolves automatically, with retry raised to 3 for intermittent challenges.

3 · The same request as a URL
curl 'https://pro.microlink.io/?url=https%3A%2F%2Fhard-target.com&screenshot=true&meta=false' \
  -H 'x-api-key: $MICROLINK_API_KEY'

The proxy comes with every API key, so the URL targets pro.microlink.io with the x-api-key header and no proxy parameter. An x-fetch-mode response header ending in -proxy, such as prerender-proxy, confirms the route.

Parameters used
  • proxy Automatic with any API key, no value needed. Pass an object with location or url only to pin a country or bring your own server.
  • proxy.location Two-letter ISO country code that pins the exit country of the proxy. Default us. Any API key.
  • retry Server-side retries with exponential backoff for intermittent challenges. Default 2.
  • headers Forwards a language or a custom header when the target expects one. Any API key.
  • ttl Caches the unblocked capture from 1 minute to 31 days so repeat calls skip the proxy path entirely. Any API key.

Confirm the proxy was used with the x-fetch-mode response header: any value ending in -proxy means the request went through it. If a capture still fails, the screenshot troubleshooting guide walks through timing, blocking and plan errors in order.

Why it works

Why a built-in proxy beats maintaining your own proxy list

A proxy is only useful if it is the right proxy, at the right time, without leaking credentials into your screenshot URLs. Building it into the API removes three chores.

01 · Resolved for you
The API decides when and how to route.
Microlink identifies the antibot provider behind a 403 and escalates through proxy tiers until one gets through, then remembers that tier for the domain. You never maintain a pool, rotate IPs or debug which exit is burned.

The resolution works on every product, so the same API key unblocks a Markdown conversion of a bot-protected page or a metadata request for the same site.

02 · An explicit signal
EPROXYNEEDED tells you exactly when a target needs an API key.
Instead of guessing from a blank image, the keyless endpoint rejects a bot-protected target with a code you can catch. Send only those targets to your API key, and every other capture stays on the keyless route.

The signal surfaces on the keyless endpoint. Automatic proxy resolution comes with every API key, the free one included, so a request sent with your key from the start never needs the keyless fallback.

03 · Bring your own if you must
proxy.url routes through your own provider.
If a contract or a region requires a specific proxy, pass its URL as proxy.url and Microlink still handles the browser, the retries and the errors around it. Every sub-request of the page, from redirects to assets, goes through that server.

When not to: the proxy does not log you into anything. For pages behind authentication, forward the session as a request header instead. If the site is also bot-protected, your API key handles the proxy on top.

FAQ

Is the proxy for screenshots of blocked websites included in the price?

Yes. Automatic proxy resolution is included and on by default with every API key, the free one too, with no separate proxy bill. The keyless endpoint surfaces the EPROXYNEEDED signal but cannot route through the proxy.

How do I know a screenshot was taken through the proxy?

Check the x-fetch-mode response header. Values ending in -proxy, such as prerender-proxy or fetch-proxy, mean the request was routed through the proxy, and x-pricing-plan: pro confirms it ran with an API key, not on the keyless endpoint.

How do I screenshot a Cloudflare-protected site?

Send the request with an API key, no extra parameter. Sites protected by Cloudflare, DataDome, Akamai and similar antibot services refuse datacenter traffic, and the API escalates through proxy tiers, up to residential, until the capture goes through.

Can I choose the country of the screenshot proxy?

Yes. Pass proxy.location with a two-letter ISO country code to pin the exit country; the default is us. See screenshot a website from another country for the full recipe.

Why is the first screenshot of a protected site slower?

The first capture may climb several proxy tiers before one gets through, and the residential tier is the slowest. The tier that worked is cached per domain, so later screenshots of that site go straight to it. See proxy resolution for how the escalation works.
Related use cases

Solve the next problem with the same API

Screenshot a site from another country

Pin the request to a country with a two-letter code and capture the prices and copy a local visitor sees.

Screenshots behind a login

Forward a session cookie or a bearer token as a request header and capture pages only your users can see.

Screenshots of JavaScript-rendered pages

Wait for a selector, a lifecycle event or a delay so single-page apps and lazy sections finish rendering before capture.

Screenshots under traffic spikes

Absorb bursts of screenshot traffic without a browser pool: no throttling, parallel requests and a cache whose hits are free.

Markdown from bot-protected pages

Convert pages behind Cloudflare, DataDome or Akamai: with any API key the built-in proxy resolves automatically.

Link previews for bot-protected sites

Unfurl links to sites behind Cloudflare or DataDome: with any API key the built-in proxy resolves automatically.

Ready to screenshot hard targets?

No option, no proxy list. Get your free API key and capture the pages that block everyone else.