Website Thumbnail API: Generate URL Preview Images
Generate website thumbnail images from any URL via API. Viewport or full-page captures, custom dimensions, JPEG or PNG. Cache in Redis, serve from S3. No browser required.
Website Thumbnail Generation via API
Website thumbnails are used everywhere: link preview cards in productivity tools, bookmark managers, site galleries, browser extension new tab pages, and competitive research dashboards. Generating them requires a real browser render — static HTTP fetches only retrieve server-rendered HTML without loading CSS, fonts, or JavaScript-driven content. SnapAPI provides a single API endpoint that returns a ready-to-use thumbnail image for any URL.
Generate a Thumbnail
# Viewport-only thumbnail (fast, no scroll)
curl "https://api.snapapi.pics/v1/screenshot?url=https://example.com&width=1280&height=800&format=jpeg&quality=80" \
-H "X-Api-Key: YOUR_API_KEY" \
--output thumbnail.jpg
# Full-page thumbnail
curl "https://api.snapapi.pics/v1/screenshot?url=https://example.com&full_page=true&format=jpeg&quality=75" \
-H "X-Api-Key: YOUR_API_KEY" \
--output full-page.jpgFor bookmark managers and link cards, the viewport-only capture at 1280x800 is the right choice: it shows exactly what the page looks like on a typical laptop screen and loads fast because it does not scroll the full page length. JPEG at quality 75-80 keeps file sizes under 150 KB for most sites, acceptable for thumbnail use.
Thumbnail Service in Node.js
// Express route: GET /thumbnail?url=https://example.com
app.get("/thumbnail", async (req, res) => {
const { url } = req.query;
const cacheKey = `thumb:${url}`;
// Check Redis cache
const cached = await redis.getBuffer(cacheKey);
if (cached) {
res.setHeader("Content-Type", "image/jpeg");
res.setHeader("X-Cache", "HIT");
return res.send(cached);
}
// Generate via SnapAPI
const params = new URLSearchParams({ url, width: "1280", height: "800", format: "jpeg", quality: "80" });
const snap = await fetch(`https://api.snapapi.pics/v1/screenshot?${params}`,
{ headers: { "X-Api-Key": process.env.SNAPAPI_KEY } });
const buf = Buffer.from(await snap.arrayBuffer());
await redis.setEx(cacheKey, 86400, buf); // 24h TTL
res.setHeader("Content-Type", "image/jpeg");
res.setHeader("X-Cache", "MISS");
res.send(buf);
});The Redis cache prevents duplicate API calls for the same URL within 24 hours. On a bookmark manager with 10,000 saved links, a cache hit rate above 90% means only 1,000 SnapAPI calls needed per day for all thumbnail renders.
Thumbnail Size and Format Recommendations
Different thumbnail use cases call for different dimensions. For new tab page browser extensions: 1280x800 JPEG at quality 80. For link cards in productivity tools: 640x400 JPEG at quality 80. For social media OG images: 1200x630 JPEG at quality 85. For site gallery grids: 320x200 JPEG at quality 75. For retina displays, double the dimensions and use quality 70 — the smaller file size from lower quality compensates for the larger pixel count.
Start with 200 free thumbnail captures at snapapi.pics. No credit card required. All size and format parameters are available on the free tier.