Docs menu
Screenshot API

thumbs.php

Returns an image of a page. If there is no capture yet, it starts a render and returns a placeholder right away.

GEThttps://api.pagepeeker.com/v2/thumbs.php?size=size&url=url&code=code

Parameters

ParameterDescription
urlrequired

The page to capture, URL encoded. PDF URLs work too and give an image of the first page. IP addresses are refused.

sizerequired

t 90 x 68, s 120 x 90, m 200 x 150, l 400 x 300 or x 480 x 360. Premium accounts can have other sizes.

coderequired

Your API key. Keep it on your server: anyone who sees it can spend your API calls. How accounts are identified covers the one case that goes without it.

viewportoptional

The browser window to render in, as 1280x800. Needs a code. Captures are cached by URL and size, so it applies the next time that capture renders.

agentoptional

The User-Agent to send to the page, up to 512 characters. Needs a code. Like viewport, it applies the next time that capture renders.

refreshoptionalpremium

Set to 1 to render a new capture. See Getting a fresh capture.

waitoptionalpremium

The longest to hold the request open for a render, in seconds, from 2 to 60. Any other number waits 20 seconds. If the render takes longer, you get the placeholder.

What you get back

A status of 200 doesn't always mean the capture you asked for. Use thumbs_ready.php or the headers below when your code needs to know which one it received.

StateResponseWhen
readyThe capture, as an imageA capture exists and is still inside your cache time.
queuedA placeholder, or your loading imageThis is the first request for this URL and size, and the render is running.
staleThe older captureThe capture has expired. A new render is running and will replace it.
errorA "Thumbnail not available" image, with X-PP-Error: TrueThe code is unknown, the account is inactive, or the request could not be matched to an account. X-PP-Error-Message says which.
errorA transparent image, with X-PP-Error: TrueThe page could not be captured.

Response headers

HeaderMeaning
X-PP-ErrorTrue if there was an error, otherwise False.
X-PP-Error-MessageWhy the request was refused. Only on refused requests.
X-PP-TimestampWhen the file served was made, as a Unix timestamp.
X-PP-Capture-TimeHow long the capture took, in seconds.
X-PP-Final-URLWhere the URL ended up after redirects.
X-PP-Capture-MethodThe engine label, for support.
X-PP-HashA hash of the URL, for support.
Response headers
HTTP/1.1 200 OK
Content-Type: image/jpeg
X-PP-Error: False
X-PP-Timestamp: 1793534000
X-PP-Capture-Time: 3.21
X-PP-Final-URL: https://example.org/

Example

import requests

res = requests.get("https://api.pagepeeker.com/v2/thumbs.php", params={
    "size": "x",
    "code": "YOUR_CODE",
    "refresh": 1,
    "wait": 30,
    "url": "https://example.org/pricing",
})
print(res.headers["X-PP-Timestamp"])
with open("capture.jpg", "wb") as f:
    f.write(res.content)
NoteEvery request counts as one API call, including those that return a placeholder.