Docs menu
Guides

Getting a fresh capture

Captures renew on their own when your cache time ends. On Premium you can ask for a new one whenever you need it.

When captures renew

A capture stays in the cache for 7 days on Basic, 5 days on Advanced, and as long as you choose on Premium. The first request after that returns the old capture and starts a new render, which replaces it when it's done.

Ask for a new one

Add refresh=1 on a Premium account. To get the new capture in the same response, add wait too: the request stays open until the render is done, or until the time you gave runs out.

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)

Know that it arrived

refresh=1 without wait returns the old capture while the new one renders, and thumbs_ready.php keeps answering IsReady: 1 because a capture is still on file. To tell the two apart, compare the X-PP-Timestamp header: it changes when the new capture replaces the old one.

NoteSend refresh=1 once, not on every poll. Each one starts another render.