Use Case Guide ยท Updated February 2026

Link Preview API: Generate Rich URL Previews

Every modern messaging app โ€” Slack, Discord, iMessage, WhatsApp โ€” unfurls shared links into rich preview cards showing a thumbnail, title, and description. Building this feature yourself means running headless browsers, parsing Open Graph tags, handling timeouts, and managing infrastructure. Or you can use a link preview API and get it done in one call.

๐Ÿ”— Build Link Previews in Minutes

Screenshot + metadata extraction in a single API. 200 free captures/month.

Get Free API Key โ†’

How Link Previews Work

A rich URL preview typically includes three components: a visual thumbnail of the page, the page title, and a short description. Apps like Slack fetch Open Graph meta tags (og:title, og:description, og:image) to assemble these cards. But many websites have missing or broken OG tags, and the og:image is often a generic logo rather than a useful preview.

SnapAPI solves this by combining screenshot capture with data extraction. You get a real visual thumbnail of the page plus structured metadata โ€” regardless of whether the site has proper OG tags.

Generate Link Previews with SnapAPI

Step 1: Capture a Thumbnail

curl "https://api.snapapi.pics/v1/screenshot?url=https://example.com&width=1200&height=630&format=webp" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o preview.webp

Step 2: Extract Metadata

curl "https://api.snapapi.pics/v1/extract?url=https://example.com" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Returns JSON with title, description, favicon, OG tags, etc.

Node.js Example

async function getLinkPreview(url) {
  const [screenshot, metadata] = await Promise.all([
    fetch(`https://api.snapapi.pics/v1/screenshot?url=${encodeURIComponent(url)}&width=1200&height=630&format=webp`, {
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    }),
    fetch(`https://api.snapapi.pics/v1/extract?url=${encodeURIComponent(url)}`, {
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    }).then(r => r.json())
  ]);

  return {
    thumbnail: Buffer.from(await screenshot.arrayBuffer()),
    title: metadata.title,
    description: metadata.description,
    favicon: metadata.favicon
  };
}

Python Example

import requests
from concurrent.futures import ThreadPoolExecutor

def get_link_preview(url):
    headers = {'Authorization': 'Bearer YOUR_API_KEY'}

    def fetch_screenshot():
        return requests.get(
            'https://api.snapapi.pics/v1/screenshot',
            params={'url': url, 'width': 1200, 'height': 630, 'format': 'webp'},
            headers=headers
        ).content

    def fetch_metadata():
        return requests.get(
            'https://api.snapapi.pics/v1/extract',
            params={'url': url},
            headers=headers
        ).json()

    with ThreadPoolExecutor() as pool:
        thumb_future = pool.submit(fetch_screenshot)
        meta_future = pool.submit(fetch_metadata)

    return {
        'thumbnail': thumb_future.result(),
        'title': meta_future.result().get('title'),
        'description': meta_future.result().get('description')
    }

Why Use an API vs DIY Link Previews

AspectDIY (Puppeteer/Playwright)SnapAPI
Setup timeDays (browser, queue, infra)5 minutes
InfrastructureHeadless Chrome servers, memory-hungryZero โ€” fully managed
Cookie bannersManual handling per siteAuto-blocked
OG tag extractionSeparate parsing logic neededBuilt-in extract endpoint
Timeout handlingComplex retry logicHandled automatically
ScalingYou manage concurrencyAuto-scales
Cost at low volume$20-50/mo for a serverFree (200/mo)

Use Cases for Link Preview APIs

๐Ÿ’ฌ Chat Applications

Show rich link cards when users share URLs in chat, just like Slack and Discord.

๐Ÿ“ CMS & Blogging

Auto-generate preview cards for outbound links in blog posts and articles.

๐Ÿ“ฑ Social Feeds

Render link previews in social timelines with real thumbnails instead of generic icons.

๐Ÿ“ง Email Builders

Embed visual link previews in marketing emails and newsletters.

Optimizing Link Preview Performance

For the best user experience, cache your link previews. Fetch the screenshot and metadata when a link is first shared, store the result, and serve it from cache on subsequent requests. SnapAPI returns results in under 3 seconds, but caching makes subsequent loads instant.

Use format=webp for thumbnails โ€” they're 30-50% smaller than PNG with comparable quality. Set width=1200&height=630 for the standard OG image dimensions that look great on all platforms.

Start Building Link Previews Today

One API for screenshots and metadata. No headless browser to manage.

Get Free API Key โ†’

FAQ

How fast are link preview captures?

Most screenshots complete in 2-4 seconds. Metadata extraction is typically under 1 second. Run them in parallel for the fastest results.

Can I customize the thumbnail size?

Yes. Set any width and height parameters. Common sizes are 1200ร—630 (OG standard) and 400ร—300 (compact cards).

What if a site blocks screenshots?

SnapAPI uses real Chromium with proper headers and cookie banner dismissal. It works on the vast majority of public websites.

Does the Extract endpoint return Open Graph data?

Yes. It returns og:title, og:description, og:image, favicon, and more in a structured JSON response.

Related: Free Screenshot API Guide ยท Social Media Card Generation ยท API Documentation

Ready to Get Started?

Start capturing screenshots for free โ€” no credit card required.

Start Free โ†’ 200 Screenshots/Month