Thumbnail API

Generate website thumbnails automatically from any URL. Resize and crop screenshots to any dimension with a single API call.

Get Free API Key

Generate Website Thumbnails On Demand

A website thumbnail is a small-scale screenshot of a web page, typically used as a visual preview in link management tools, bookmark applications, browser history UIs, and website gallery pages. SnapAPI generates thumbnails from any URL by capturing a full-resolution screenshot and resizing it to your specified dimensions in the same API call. The thumb_width parameter accepts a pixel value and scales the screenshot to that width while preserving the aspect ratio, eliminating the need for a separate image resizing step. For square thumbnails used in grid layouts, capture at a fixed viewport width and height, then resize to your target thumbnail dimension.

# Python: generate a 400px wide thumbnail
import requests

resp = requests.get(
    "https://api.snapapi.pics/screenshot",
    params={
        "url": "https://github.com/trending",
        "format": "jpeg",
        "viewport_width": 1280,
        "viewport_height": 800,
        "thumb_width": 400,
    },
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)
open("thumbnail.jpg", "wb").write(resp.content)
print(f"Thumbnail: {len(resp.content):,} bytes")
// Node.js: batch thumbnail generation
const apiKey = process.env.SNAPAPI_KEY;

async function thumbnail(url, width = 400) {
  const params = new URLSearchParams({
    url,
    format: 'jpeg',
    viewport_width: '1280',
    viewport_height: '800',
    thumb_width: String(width),
  });
  const resp = await fetch(
    `https://api.snapapi.pics/screenshot?${params}`,
    { headers: { Authorization: `Bearer ${apiKey}` } }
  );
  if (!resp.ok) throw new Error(`Thumbnail failed: ${resp.status}`);
  return Buffer.from(await resp.arrayBuffer());
}

// Generate thumbnails for a list of URLs
const urls = ['https://example.com', 'https://github.com', 'https://vercel.com'];
const thumbnails = await Promise.all(urls.map(u => thumbnail(u)));
thumbnails.forEach((t, i) => require('fs').writeFileSync(`thumb_${i}.jpg`, t));

Thumbnail Sizes for Common Use Cases

Different use cases call for different thumbnail dimensions. Link preview cards in chat applications typically use thumbnails around 400x250 pixels, which fits well in message thread layouts without dominating the visible area. Browser bookmarks and history grids often use square thumbnails at 200x200 or 300x300 pixels. Website gallery and directory pages use larger thumbnails around 600x400 pixels to give visitors enough detail to recognize the page content at a glance. Social media preview thumbnails at 1200x630 pixels are the standard for OG images shared on Twitter and LinkedIn. Video platform-style cards use a 16:9 aspect ratio at various resolutions. SnapAPI's thumb_width and viewport parameters give you full control over the output size without requiring a separate image processing pipeline. Generate the thumbnail at the exact size your UI needs to avoid client-side rescaling artifacts.

Thumbnail Storage and CDN Delivery

Thumbnails should be generated once per URL and stored in a CDN-backed storage service rather than regenerated on every request. When a new URL is added to your application, enqueue a thumbnail generation job that calls SnapAPI, stores the result in S3, and updates the database record with the CDN URL. Serve thumbnails from CloudFront, Fastly, or Cloudflare CDN with long cache headers rather than proxying through your application server. This architecture eliminates per-request API calls for thumbnail display, serves thumbnails from a globally distributed CDN for low latency, and decouples thumbnail generation timing from the request path. For applications with high URL turnover where thumbnails become stale, implement a background refresh job that recaptures thumbnails older than your configured staleness threshold. For most use cases, a one-week or one-month refresh interval is appropriate since most web pages do not change significantly enough in that period to warrant more frequent thumbnail regeneration.

Handling Thumbnail Generation Failures

Thumbnail generation fails more often than screenshot generation for general URL-based screenshots because thumbnails are typically generated for URLs submitted by users, which includes a higher proportion of broken links, private pages, authentication-required pages, and pages with aggressive bot detection. Design your thumbnail generation system to handle failures gracefully. On API error, store a failure record in the database and use a generic placeholder thumbnail in the UI rather than showing a broken image. Retry failed thumbnails after a configurable delay: some failures are transient (network error, temporary rate limiting) while others are permanent (private page, bot-blocked domain). After three failed attempts with exponential backoff, mark the URL as permanently failed and stop retrying to avoid wasting API quota on URLs that will never produce a successful thumbnail. For particularly high-value URLs where a placeholder thumbnail is unacceptable, implement a fallback to favicon-based minimal previews: fetch the favicon from the target domain and display it in a styled frame as the thumbnail, which provides some visual differentiation while the actual screenshot fails.

Thumbnail API Pricing

Thumbnail generation uses the same request quota as any other screenshot request. Each thumbnail generation call consumes one request from your monthly quota, regardless of the output size or format. The thumb_width parameter does not cost extra compared to a full-resolution screenshot. For applications that generate thumbnails for user-submitted URLs, the monthly request count equals the number of unique URLs for which thumbnails are generated during that month, assuming proper caching and deduplication. The free tier at 200 requests per month is sufficient to build a thumbnail generation prototype and test it against your real URL data before upgrading. The Starter plan at 19 dollars per month and 5,000 requests supports a bookmark or link management application adding up to 160 new unique URLs per day. The Growth plan at 79 dollars per month and 50,000 requests supports up to 1,600 new URLs per day. Custom enterprise plans are available for applications with higher thumbnail generation volume.

Thumbnail Generation for Bookmark and Link Management Apps

Bookmark and link management applications are the most common use case for website thumbnail APIs. When a user saves a URL, the application needs to present it visually in a grid or list layout so the user can quickly identify the content at a glance. A bare URL in a list provides no visual information. A domain favicon gives minimal information. A thumbnail screenshot gives the user an immediate visual sense of what the page contains, dramatically improving the usability of a bookmark collection that grows beyond a few dozen items. SnapAPI generates the thumbnail in the background after the URL is saved, stores it in S3 or another CDN-backed storage service, and the application displays it once available. The latency of thumbnail generation (typically 2 to 5 seconds) is acceptable for background generation since the user does not need to wait for it. The bookmark item can display a loading skeleton while the thumbnail is being generated and update automatically when it becomes available using a websocket or short-poll refresh pattern.

Thumbnail API for Browser Extensions

Browser extensions that capture or organize URLs benefit significantly from thumbnail generation. A tab organizer extension that groups open tabs benefits from visual thumbnails that help users identify which tab contains which page without reading the full title. A reading list extension that saves articles for later reading benefits from article hero image thumbnails or full-page screenshots that remind users what they saved. Because browser extensions run in the user's browser and should not expose API keys to client-side code, thumbnail generation requests should be proxied through a backend service: the extension sends the URL to your backend, the backend calls SnapAPI with the stored API key, and the thumbnail is returned to the extension via the backend. This keeps the SnapAPI key secure on the server side while enabling browser extensions to use the thumbnail generation capability. For extensions that need thumbnails immediately (not in the background), the backend should be optimized for low latency, ideally served from a serverless function in the region closest to the majority of your users.

CMS and Content Management Thumbnails

Content management systems and editorial tools benefit from thumbnail generation for external URLs included in articles, newsletters, and social posts. When an editor pastes a URL into a rich text field, the CMS can display a visual thumbnail preview of the linked page in the editor interface, giving the editor confidence that the link points to the intended page before publishing. For newsletters, thumbnail previews of featured links help editors verify that the link metadata and visual appearance will look correct in the email before sending. For social media scheduling tools, visual previews of the link being shared allow content creators to verify that the OG image and title look compelling in the preview card before scheduling the post. In each of these cases, the thumbnail generation is triggered by user input (pasting a URL) and should complete within a few seconds to fit naturally into the editorial workflow without requiring the editor to take additional action.