Shotfly

Use case

Link preview API

When a user pastes a link, show a real preview. One request returns a thumbnail plus the page metadata, and signed URLs let you embed the image directly.

https://github.com/nodejs/node
Thumbnail of https://github.com/nodejs/node, captured by Shotfly
GitHubGitHub - nodejs/node: Node.js JavaScript runtime โœจ๐Ÿข๐Ÿš€โœจNode.js JavaScript runtime โœจ๐Ÿข๐Ÿš€โœจ. Contribute to nodejs/node development by creating an account on GitHub.
"credits_charged": 1,"metadata": {"title": "GitHub - nodejs/node: Node.js JavaScript runtime โœจ๐Ÿข๐Ÿš€โœจ""siteName": "GitHub""image": "https://opengraph.githubassets.com/16a538da33e863557c3f944eca5dd17213ee39117db05130f3560754f7901b0d/nodejs/node""favicon": "https://github.githubassets.com/favicons/favicon.png"}
Real metadata ยท response_type=json ยท github.com ยท 2026-11-30 UTC
  1. 01

    response_type=json returns title, description, og:image, site name and favicon with a link to the thumbnail.

  2. 02

    thumbnail_width resizes on our side; cache_ttl controls how long results are reused, and cache hits are free.

  3. 03

    Signed URLs (pk_ key + signature) can go straight into <img src> or og:image without exposing your secret.

One request.

Every option is a parameter; see the parameter reference.

Example
curl "https://api.shotfly.dev/v1/screenshot?url=https://example.com&response_type=json&thumbnail_width=400" \
  -H "Authorization: Bearer $SHOTFLY_SECRET_KEY"

How do I get a link preview for a URL?

Request the page with response_type=json. Shotfly renders it, reads the title, description, Open Graph image, site name and favicon from the page, and returns them with a link to a thumbnail. Use the page's own og:image when it has one, and the thumbnail when it doesn't.

const target = 'https://example.com'
const params = new URLSearchParams({ url: target, response_type: 'json', thumbnail_width: '400' })
const res = await fetch(`https://api.shotfly.dev/v1/screenshot?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SHOTFLY_SECRET_KEY}` },
})
const body = await res.json()
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`)

const m = body.metadata ?? {}
const preview = {
  url: m.canonical ?? target,
  title: m.title ?? new URL(target).hostname,
  description: m.description ?? '',
  // The page's own image if it has one, else the thumbnail (the link expires in one hour).
  image: m.image ?? body.url,
  favicon: m.favicon,
  siteName: m.siteName,
}
console.log(preview)

Which fields does the JSON response have?

FieldWhat it holds
url, url_expires_atA link to the image, valid for one hour
width, height, bytes, content_typeThe image
credits_charged, cacheWhat the request cost (0 for a cache hit), and hit or miss
metadata.titleog:title, or the page title
metadata.descriptionog:description, or the meta description
metadata.imageog:image, or twitter:image
metadata.siteName, metadata.typeog:site_name and og:type
metadata.url, metadata.canonicalog:url (or the final page address) and <link rel="canonical">
metadata.favicon<link rel="icon">, or /favicon.ico
metadata.lang, metadata.themeColor<html lang> and the theme-color meta tag

Fields the page doesn't have are left out, and metadata is null when Shotfly could not read any.

Can I put the preview image straight into my page?

Yes, with a signed URL. Sign the parameters with your secret on your server and use the result in <img src>: the URL carries your public key (pk_โ€ฆ) and a signature, never the secret. Signed images are served with a public Cache-Control header, so browsers and CDNs can keep them. The signing function is on authentication and signed URLs.

How fresh are previews, and what do they cost?

A preview costs 1 credit when it succeeds. Results are cached for cache_ttl seconds (one day by default, up to 30 days), and cache hits are free. Pass fresh=true to render the page again, for example after a user edits it.

What are the limits?

  • The metadata is whatever the page declares. Tags that a script adds late may need wait_for_selector.
  • The url link expires after one hour: copy the image to your own storage, or use a signed URL.
  • Sites that block automated browsers fail with target_blocked and cost nothing.
  • Every preview is a browser render, which takes longer than reading the HTML alone. Fetch previews in the background rather than while the user waits.