Code Examples
Copy-paste examples to start generating screenshots in seconds. Replace sk_your_api_key with your actual API key.
Basic Screenshot
Capture a post and save it as a PNG file.
1# Save a tweet screenshot to screenshot.png2curl -o screenshot.png \3 "https://postcapture.com/api/screenshot?postUrl=https://x.com/postcaboron/status/1924847327370461555&apiKey=sk_your_api_key"
Custom Settings
Customize the screenshot appearance with additional query parameters.
1# Dark theme, no watermark, hide follower count2curl -o screenshot.png \3 "https://postcapture.com/api/screenshot?\4postUrl=https://x.com/postcaboron/status/1924847327370461555&\5apiKey=sk_your_api_key&\6theme=dark&\7showWatermark=false&\8showFollowerCount=false&\9padding=50&\10scaleFactor=3"
Multi-Platform
The same endpoint works for all supported platforms. Just change the postUrl.
1# Twitter / X2curl -o twitter.png "https://postcapture.com/api/screenshot?postUrl=https://x.com/postcaboron/status/1924847327370461555&apiKey=sk_your_api_key"34# YouTube5curl -o youtube.png "https://postcapture.com/api/screenshot?postUrl=https://youtube.com/watch?v=dQw4w9WgXcQ&apiKey=sk_your_api_key"67# TikTok8curl -o tiktok.png "https://postcapture.com/api/screenshot?postUrl=https://tiktok.com/@user/video/1234567890&apiKey=sk_your_api_key"910# Bluesky11curl -o bluesky.png "https://postcapture.com/api/screenshot?postUrl=https://bsky.app/profile/user.bsky.social/post/abc123&apiKey=sk_your_api_key"
Batch Processing with Rate Limit Handling
Process many URLs while respecting the 10 requests/minute rate limit.
1import { writeFile } from "node:fs/promises";23const API_KEY = process.env.POSTCAPTURE_API_KEY;4const DELAY_MS = 7000; // ~8.5 requests/min to stay under the limit56const urls = [7 "https://x.com/postcaboron/status/1924847327370461555",8 "https://x.com/elonmusk/status/1234567890",9 // ... more URLs10];1112async function captureOne(postUrl, index) {13 const url = new URL("https://postcapture.com/api/screenshot");14 url.searchParams.set("postUrl", postUrl);15 url.searchParams.set("apiKey", API_KEY);1617 const res = await fetch(url);1819 if (res.status === 429) {20 const wait = parseInt(res.headers.get("Retry-After") || "10");21 console.log(`Rate limited. Waiting ${wait}s…`);22 await new Promise((r) => setTimeout(r, wait * 1000));23 return captureOne(postUrl, index); // retry24 }2526 if (!res.ok) throw new Error(`${res.status} for ${postUrl}`);2728 const file = `screenshot-${index}.png`;29 await writeFile(file, Buffer.from(await res.arrayBuffer()));30 console.log(`[${index + 1}/${urls.length}] Saved ${file}`);31}3233for (let i = 0; i < urls.length; i++) {34 await captureOne(urls[i], i);35 if (i < urls.length - 1) {36 await new Promise((r) => setTimeout(r, DELAY_MS));37 }38}3940console.log("Done!");