Docs menu
Endpoints

Show a screenshot (signed link)

A screenshot as an image address, for an <img src>: the options in the query, signed with your signing secret, so it needs no key and nobody can change it. Rendered on its first view, answered from the cache after.

GEThttps://api.pagepeeker.com/v3/shot?options&key_id=key id&signature=signature

Authentication

The signature, made with the signing secret of the key that key_id names (Authentication). Views count toward a limit of their own, 120 a minute from each visitor's address, not your requests per minute. A link with a wrong signature counts nothing.

Request

The options come first, in any order, then key_id, then signature, last. Booleans are true, false, 1 or 0, in lower case; numbers are digits; each option at most once.

Query parameterDescription
urlstringrequired

The page, http or https, up to 2,048 characters. https:// is added when there is no scheme.

viewport_widthintegeroptional

The browser window's width, 320 to 3,840. Default: 1280.

viewport_heightintegeroptional

The browser window's height, 200 to 4,320. With both width and height, it is worked out from them: leave it out. Default: 1024.

device_scale_factorintegeroptional

1, 2 or 3: pixels per CSS pixel, for sharp images on high-density screens. Default: 1.

full_pagebooleanoptional

true for the whole page, not just the window. The page is scrolled first, so images that load on scroll are in. Cut at 16,383 pixels of image. Default: false.

formatstringoptional

jpeg, png or webp. Default: "jpeg".

qualityintegeroptional

1 to 100, for jpeg and webp only. Default: 80.

widthintegeroptional

The image resized to this width, 16 to 3,840: a thumbnail. Alone, it keeps the capture's proportions. Default: none, the capture's width.

heightintegeroptional

The image resized to this height, 16 to 16,383. With width, the window takes their proportions, so the image is exactly that box. With full_page, the page is cut at this height. Default: none, the capture's height.

delayintegeroptional

Seconds to wait after the page has loaded, 0 to 10. Default: 0.

wait_untilstringoptional

When the page counts as loaded: load, domcontentloaded, networkidle0 (no requests for half a second) or networkidle2 (at most two). If it isn't reached, the page is captured anyway. Default: "networkidle2".

wait_for_selectorstringoptional

A CSS selector to wait for before the capture, up to 255 characters. If it doesn't appear in 30 seconds, the render fails as a timeout. Default: none.

block_cookie_bannersbooleanoptional

Answers the page's cookie banner as a visitor would, rejecting, so the capture has no banner. Default: true.

block_adsbooleanoptional

Blocks ads and trackers. Default: false.

dark_modebooleanoptional

Asks the page for its dark theme (prefers-color-scheme: dark). Default: false.

user_agentstringoptional

The browser's User-Agent, up to 512 printable characters. PagePeeker's robot signature is added at its end. Default: Chrome's.

accept_languagestringoptional

The languages the browser asks for, as en-US,en;q=0.9, up to 100 characters. Sites that go by the visitor's address may still answer in German: the robot renders from Germany. Default: none.

cache_ttlintegeroptional

How old a cached render may be to be answered, in seconds, 86,400 to 2,592,000 (a day to 30 days): a signed link takes no less than a day. Default: 86400, a day.

Query parameterDescription
key_idstringrequired

The first 8 characters of your API key, after the options.

signaturestringrequired

Last: the HMAC-SHA256, in hex, of everything before &signature=, exactly as it is in the link, with your signing secret. Any change to the link, an option or a character of its encoding, needs a new signature.

Not taken: wait and fresh (anyone who has the link could make every view a new render).

Response

Always something an <img> can show, never JSON:

AnswerWhen
302 to the imageThe render is in the cache, or was done within 30 seconds. The redirect may be cached for what is left of cache_ttl. It carries the limit headers, for this visitor's minute.
200, a "being rendered" PNG, 640 x 480The render wasn't done in 30 seconds. Not cached: the next view gets the render.
200, a "not available" PNG, 640 x 480, with X-PP-Error-CodeThe page couldn't be rendered (the header has the reason), or the link was refused (it has the error code: invalid_signature, invalid_option, rate_limited, over_quota and so on). Not cached.

Status codes

StatusAnswerWhen
302Redirect to the imageDone.
200An image of oursNot done in 30 seconds, failed, or refused: see the response.

Every endpoint can also answer 403 https_required, 405 method_not_allowed, 500 internal_error. What each error means and what to do about it: Errors and failures.

Example

import hashlib, hmac
from urllib.parse import urlencode

KEY_ID = "pp_4kT9z"  # the first 8 characters of your API key
SECRET = "YOUR_SIGNING_SECRET"


def signed_link(options):
    query = urlencode(options) + "&key_id=" + KEY_ID
    signature = hmac.new(SECRET.encode(), query.encode(), hashlib.sha256).hexdigest()
    return "https://api.pagepeeker.com/v3/shot?" + query + "&signature=" + signature


print(signed_link({"url": "https://www.python.org/", "width": 480, "height": 360}))

With the signing secret YOUR_SIGNING_SECRET, that makes this link:

Signed link
https://api.pagepeeker.com/v3/shot?url=https%3A%2F%2Fwww.python.org%2F&width=480&height=360&key_id=pp_4kT9z&signature=be3aac34adfde1aa1e0e743d42d883d9ea301de9fa6d29e6ff8d2f652823ad75

How to use them in pages, who can use a link and what a view costs: Signed links.