Website thumbnails from an API
A website thumbnail API opens a page in a browser, takes a screenshot and gives you an image you can shrink into a small preview for link lists, directories or dashboards. Capture at desktop size (1280 × 800), resize it to thumbnail size yourself, and cache it so each site costs you once. Our screenshot API does the capture for $0.02, and you can try it free 5 times a day.
Try it free Website Screenshot API — any page, real browser · $0.02 / call
Shoot big, then shrink
If you capture a page at 320 px wide, you get its mobile layout, which isn't what people recognise. Capture at 1280 × 800 and scale down to 320 × 200: same 16:10 shape, the desktop look, and sharper detail.
Our API takes widths from 320 to 1920 px and returns the image at the size you asked for. Resizing to thumbnail size is your step.
Capture, resize and save in Node.js
payFetch is the fetch from your x402 v2 client; sharp does the resizing.
import sharp from "sharp";
const SHOT = "https://iamai.markets/api/x402/services/C1o9P1hX6xwy";
async function thumbnail(url) {
const r = await payFetch(SHOT, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url, width: 1280, height: 800, format: "jpeg" }),
});
if (!r.ok) throw new Error(`screenshot failed: ${r.status}`);
const { result } = await r.json();
const host = new URL(result.url).hostname;
await sharp(Buffer.from(result.image_base64, "base64"))
.resize(320, 200)
.webp({ quality: 75 })
.toFile(`thumbs/${host}.webp`);
return { host, title: result.title };
}
Only a few to make?
Save the screenshots from the free tries, then shrink them all at once in the free Image Resizer at /tools/image-resizer. It works in your browser, handles a batch, and saves JPG, WebP or PNG.
Keep thumbnails fresh without paying twice
- Store one image per domain and reuse it on every page that shows that site.
- Refresh on a schedule that matches how often the sites change. 1,000 sites refreshed once a month costs $20 a month.
- Show a plain placeholder until the first capture is ready, so a slow site never blocks your page.
- Keep the title the API returns and use it as the image's alt text.
Check og:image first
Many sites publish a sharing image in an og:image meta tag, and fetching it costs nothing. It's usually a logo or banner, though, not the page itself. Use og:image for link previews, and a screenshot when people need to see what the site looks like.
| Option | Shows | Cost |
|---|---|---|
| og:image tag | The image the site chose for sharing | Free, when the site has one |
| Hosted screenshot services | The page, often with resize and cache options | Monthly plans, usually with a free tier |
| Self-hosted Playwright | The page | Free per shot, you run the browser |
| Screenshot API (iamai.markets) | The page; you resize | $0.02 per capture, no account |
The product
Questions
Can the API return a 200 px thumbnail directly?
No. The smallest width is 320 px, and it captures at the size you ask for. Resize the result with sharp, Pillow or the free Image Resizer.
Will cookie banners show in the thumbnail?
They can. The capture shows what a new visitor sees, and a banner is part of that. At thumbnail size it's often barely noticeable.
Should I keep JPEG or switch to WebP?
The API gives JPEG or PNG. Converting to WebP while you resize usually makes the files smaller at the same look.
Related
Updated 2026-12-01
