# Rich previews for any URL

> Generate thumbnail previews for any URL. Perfect for link sharing, bookmarks, and content cards. $1 per 1,000 screenshots.

Generate thumbnail screenshots for links in your app. Show users what they're clicking before they click. Metadata extraction included.

ThumbnailsMetadataBatch APICDN Cached

[Generate Link Previews](https://app.stack0.dev/)[View docs](https://www.stack0.dev/docs/sdk/screenshots)

TypeScriptcURL

Copy

```
import { Stack0 } from '@stack0/sdk' const stack0 = new Stack0({ apiKey: process.env.STACK0_API_KEY }) // Generate a link preview thumbnailexport async function getLinkPreview(url: string) {  const { imageUrl, metadata } = await stack0.screenshot.capture({    url,    viewport: { width: 1200, height: 630 },    // Thumbnail optimized settings    format: 'webp',    quality: 80,    // Extract page metadata too    extractMetadata: true,  })   return {    thumbnail: imageUrl,    title: metadata.title,    description: metadata.description,    favicon: metadata.favicon,  }} // Batch generate previews for multiple linksexport async function batchLinkPreviews(urls: string[]) {  const results = await stack0.screenshot.batch({    urls,    config: {      viewport: { width: 1200, height: 630 },      format: 'webp',      extractMetadata: true,    },  })   return results.map(r => ({    url: r.url,    thumbnail: r.imageUrl,    ...r.metadata,  }))}
```

## What's included

### Screenshot Capture

Reliable page rendering with JavaScript execution.

### Metadata Extraction

Title, description, favicon, OG tags. Everything for rich previews.

### Optimized Output

WebP format, configurable quality. Small files, fast loads.

### Global Cache

Thumbnails cached at CDN edge. Instant delivery worldwide.

### Auto Refresh

Set cache TTL for fresh previews. Pages change, previews update.

### Fast Generation

Screenshots generated in seconds. Async API for non-blocking workflows.

## Built for production

### Visual context

Show users what a link looks like before they click. Builds trust, increases engagement.

### Metadata extraction

Get title, description, and favicon alongside the thumbnail. Complete link cards.

### Optimized thumbnails

WebP format, proper sizing. Fast-loading previews that look great.

### Batch processing

Generate previews for multiple links at once. Perfect for feeds and lists.

### Cached results

Thumbnails cached and served from CDN. Fast delivery, reduced API calls.

### Simple pricing

$1 per 1,000 screenshots. Cached results served free.

## Common implementations

### Link Sharing

Rich previews when users share links in chat or comments.

### Bookmark Manager

Visual thumbnails for saved bookmarks and reading lists.

### Content Aggregation

Preview cards for curated links in newsletters or feeds.

### Social Cards

Generate previews for links shared on your platform.

## Frequently asked questions

What metadata is extracted with link previews?

We extract the page title, description (from meta description or og:description), favicon URL, and og:image if available. This gives you everything needed to build rich link cards.

How are thumbnails cached?

Generated thumbnails are cached on our CDN with a configurable TTL (default 24 hours). Subsequent requests for the same URL return the cached image instantly. You can force refresh by setting cache: false.

What if a page is slow to load?

We wait up to 30 seconds for pages to load by default. You can configure waitForTimeout or waitForSelector to handle slow-loading content. Failed captures return an error without charging your quota.

Can I generate previews for private/authenticated pages?

Yes. Pass cookies or headers in your request to authenticate. This is useful for generating previews of content behind login walls for authorized users.

What dimensions should I use for link previews?

We recommend 1200x630 for full-size previews (og:image standard) or 400x300 for thumbnails. The best size depends on how you display previews in your UI.

## Ready to build?

Get started in minutes.

[Get Started](https://app.stack0.dev/)

---

Source: https://www.stack0.dev/use-cases/link-previews
llms.txt: https://www.stack0.dev/llms.txt
Sitemap: https://www.stack0.dev/sitemap.xml
Documentation: https://www.stack0.dev/docs
OpenAPI spec: https://www.stack0.dev/openapi.json
MCP server: https://api.stack0.dev/mcp
