Examples
Minimal curl, Python, and Node examples for common Screenshot requests.
All examples use POST /screenshot. Substitute your API Key for shot_yourkey_here and adjust the base URL for your environment (http://localhost:8000 locally).
Curl
Download a PNG
curl -X POST http://localhost:8000/screenshot \
-H 'Authorization: Bearer shot_yourkey_here' \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com"}' \
-o screenshot.pngJSON response with hosted URL
curl -X POST http://localhost:8000/screenshot \
-H 'Authorization: Bearer shot_yourkey_here' \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com","response_type":"json"}'Python (requests)
Install: pip install requests
Download a PNG
import requests
resp = requests.post(
"http://localhost:8000/screenshot",
headers={"Authorization": "Bearer shot_yourkey_here"},
json={"url": "https://example.com"},
timeout=60,
)
resp.raise_for_status()
open("screenshot.png", "wb").write(resp.content)JSON response with hosted URL
import requests
resp = requests.post(
"http://localhost:8000/screenshot",
headers={"Authorization": "Bearer shot_yourkey_here"},
json={"url": "https://example.com", "response_type": "json"},
timeout=60,
)
resp.raise_for_status()
data = resp.json()
print(data["url"], data["expires_at"])Node (fetch)
Node 18+ includes native fetch.
Download a PNG
import fs from "node:fs/promises";
const resp = await fetch("http://localhost:8000/screenshot", {
method: "POST",
headers: {
Authorization: "Bearer shot_yourkey_here",
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://example.com" }),
});
if (!resp.ok) throw new Error(await resp.text());
const buf = Buffer.from(await resp.arrayBuffer());
await fs.writeFile("screenshot.png", buf);JSON response with hosted URL
const resp = await fetch("http://localhost:8000/screenshot", {
method: "POST",
headers: {
Authorization: "Bearer shot_yourkey_here",
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://example.com", response_type: "json" }),
});
if (!resp.ok) throw new Error(await resp.text());
const data = await resp.json();
console.log(data.url, data.expires_at);For the full option list see Screenshot reference.