Docs menu
Get started

Quickstart

Get your first screenshot from your server in a few minutes. You need a PagePeeker account.

1

Get your API key

In your account, open API key. Every call sends it as code.

WarningKeep your code on your server. Anyone who copies it can spend your monthly API calls.
2

Request a capture

Set size to one of the five standard sizes and url to the page you want. The first call to thumbs_ready.php starts the render. Repeat it until IsReady is 1, then download the image from thumbs.php with the same parameters. Each check counts as one API call, so leave a few seconds between them.

import requests, time

API = "https://api.pagepeeker.com/v2"
params = {"size": "l", "code": "YOUR_CODE", "url": "https://example.org/"}

for attempt in range(24):
    status = requests.get(f"{API}/thumbs_ready.php", params=params).json()
    if status["IsReady"] or status["Error"]:
        break
    time.sleep(5)

if status["IsReady"]:
    image = requests.get(f"{API}/thumbs.php", params=params)
    with open("capture.jpg", "wb") as f:
        f.write(image.content)
NoteCheck before you download. For a URL with no capture yet, thumbs.php returns a placeholder image with status 200.
3

Handle the answers

thumbs_ready.php answers in JSON. When Error is 1, stop checking: Errors explains why.

Response
// Still rendering
{"IsReady":0,"Error":0}

// Ready to download
{"IsReady":1,"Error":0}

// The page could not be captured
{"IsReady":0,"Error":1}