Website thumbnails for directories and marketplaces
Keep thousands of website thumbnails fresh and consistent with bulk captures, caching and signed URLs.
7 min read
Directories, marketplaces, link-in-bio tools and SaaS listings all need the same thing: a small, consistent picture of thousands of websites, kept reasonably fresh, without a cookie banner covering half of each one. Doing that with your own headless browser means a queue, a storage bucket and a lot of edge cases. Here’s how to do it with shotsmith, from a handful of sites to tens of thousands.
Make thumbnails consistent
Use the same options for every site, so your grid looks deliberate rather than random:
- Same frame:
viewport_width=1280andviewport_height=800, so every thumbnail shows the same amount of page. - Small files:
image_width=480andformat=webpreturn a thumbnail-sized image, not a full screenshot. - Clean:
block_cookie_banners,block_adsandblock_chats, so you see the site and not its pop-ups. - Calm:
reduce_motion=true, so hero animations and carousels are captured at rest.
Option A: signed URLs, no storage at all
For most directories, the simplest setup is to put a signed screenshot URL in each card’s <img> tag, with cache=true. The first visitor triggers the render; everyone after gets the cached image instantly, and cache hits are free. Set cache_ttl up to 30 days to control how often each thumbnail refreshes.
A bulk request with execute: false signs up to 100 URLs in one call, without rendering anything yet:
import { Shotsmith } from '@shotsmith/sdk';
const shotsmith = new Shotsmith({ accessKey: 'YOUR_ACCESS_KEY' });
const batch = await shotsmith.bulk(
[
{ url: 'https://shotsmith.dev/sample' },
{ url: 'https://shotsmith.dev' },
],
{ options: {
viewport_width: 1280,
viewport_height: 800,
image_width: 480,
format: 'webp',
block_cookie_banners: true,
cache: true,
}, execute: false },
);
console.log(batch);
<?php
require 'vendor/autoload.php';
use Shotsmith\Client;
$shotsmith = new Client('YOUR_ACCESS_KEY');
$batch = $shotsmith->bulk(
requests: [
['url' => 'https://shotsmith.dev/sample'],
['url' => 'https://shotsmith.dev'],
],
options: [
'viewport_width' => 1280,
'viewport_height' => 800,
'image_width' => 480,
'format' => 'webp',
'block_cookie_banners' => true,
'cache' => true,
],
execute: false,
);
print_r($batch);
curl -X POST "https://shotsmith.dev/v1/bulk" \
-H "X-Access-Key: YOUR_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"options": {
"viewport_width": 1280,
"viewport_height": 800,
"image_width": 480,
"format": "webp",
"block_cookie_banners": true,
"cache": true
},
"requests": [
{ "url": "https://shotsmith.dev/sample" },
{ "url": "https://shotsmith.dev" }
],
"execute": false
}'
const res = await fetch('https://shotsmith.dev/v1/bulk', {
method: 'POST',
headers: {
'X-Access-Key': 'YOUR_ACCESS_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
options: {
viewport_width: 1280,
viewport_height: 800,
image_width: 480,
format: 'webp',
block_cookie_banners: true,
cache: true,
},
requests: [
{ url: 'https://shotsmith.dev/sample' },
{ url: 'https://shotsmith.dev' },
],
execute: false,
}),
});
if (!res.ok) throw new Error((await res.json()).error_message);
console.log(await res.json());
import json
import urllib.request
body = {
"options": {
"viewport_width": 1280,
"viewport_height": 800,
"image_width": 480,
"format": "webp",
"block_cookie_banners": True,
"cache": True
},
"requests": [
{"url": "https://shotsmith.dev/sample"},
{"url": "https://shotsmith.dev"}
],
"execute": False
}
req = urllib.request.Request(
"https://shotsmith.dev/v1/bulk",
data=json.dumps(body).encode(),
headers={"X-Access-Key": "YOUR_ACCESS_KEY", "Content-Type": "application/json"},
method="POST",
)
# Raises urllib.error.HTTPError on a 4xx/5xx response
with urllib.request.urlopen(req, timeout=60) as res:
print(json.load(res))
<?php
$ch = curl_init('https://shotsmith.dev/v1/bulk');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['X-Access-Key: YOUR_ACCESS_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'options' => [
'viewport_width' => 1280,
'viewport_height' => 800,
'image_width' => 480,
'format' => 'webp',
'block_cookie_banners' => true,
'cache' => true,
],
'requests' => [
['url' => 'https://shotsmith.dev/sample'],
['url' => 'https://shotsmith.dev'],
],
'execute' => false,
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$response = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
throw new RuntimeException($response['error_message']);
}
print_r($response);
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"options": {
"viewport_width": 1280,
"viewport_height": 800,
"image_width": 480,
"format": "webp",
"block_cookie_banners": true,
"cache": true
},
"requests": [
{ "url": "https://shotsmith.dev/sample" },
{ "url": "https://shotsmith.dev" }
],
"execute": false
}`)
req, _ := http.NewRequest("POST", "https://shotsmith.dev/v1/bulk", body)
req.Header.Set("X-Access-Key", "YOUR_ACCESS_KEY")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}
require "net/http"
require "json"
body = {
"options" => {
"viewport_width" => 1280,
"viewport_height" => 800,
"image_width" => 480,
"format" => "webp",
"block_cookie_banners" => true,
"cache" => true
},
"requests" => [
{"url" => "https://shotsmith.dev/sample"},
{"url" => "https://shotsmith.dev"}
],
"execute" => false
}
res = Net::HTTP.post(
URI("https://shotsmith.dev/v1/bulk"),
body.to_json,
"X-Access-Key" => "YOUR_ACCESS_KEY",
"Content-Type" => "application/json"
)
raise res.body unless res.is_a?(Net::HTTPSuccess)
puts JSON.parse(res.body)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
var body = """
{
"options": {
"viewport_width": 1280,
"viewport_height": 800,
"image_width": 480,
"format": "webp",
"block_cookie_banners": true,
"cache": true
},
"requests": [
{ "url": "https://shotsmith.dev/sample" },
{ "url": "https://shotsmith.dev" }
],
"execute": false
}
""";
var request = HttpRequest.newBuilder(URI.create("https://shotsmith.dev/v1/bulk"))
.header("X-Access-Key", "YOUR_ACCESS_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var res = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}
using System;
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-Access-Key", "YOUR_ACCESS_KEY");
var body = """
{
"options": {
"viewport_width": 1280,
"viewport_height": 800,
"image_width": 480,
"format": "webp",
"block_cookie_banners": true,
"cache": true
},
"requests": [
{ "url": "https://shotsmith.dev/sample" },
{ "url": "https://shotsmith.dev" }
],
"execute": false
}
""";
var res = await http.PostAsync(
"https://shotsmith.dev/v1/bulk",
new StringContent(body, Encoding.UTF8, "application/json")
);
res.EnsureSuccessStatusCode();
Console.WriteLine(await res.Content.ReadAsStringAsync());
Each item in responses has a ready-to-use url. Save it against the listing and you’re done.
Option B: render ahead and store the files
If thumbnails must be ready the moment a page loads, or you want them on your own CDN, render them in advance:
- Send batches of up to 100 with
execute: trueand awebhook_url. Each capture is rendered in the background. - Add
store=trueand astorage_pathsuch asthumbnails/{host}to upload each image straight to your S3, R2 or Spaces bucket. - When each webhook arrives, record the stored location against the listing.
- Re-run on a schedule (monthly is plenty for most directories), or when a listing’s URL changes.
Set external_identifier to your listing ID, and it comes back in every webhook so you can match results without a lookup table.
Handle the awkward sites
- Sites that block automated browsers: add
stealth=true. Pages that still block aren’t billed. - Dead or slow sites: failed renders are free and return a clear
error_code, so you can show a placeholder and retry next week. - Splash screens:
wait_for_selectoror a shortdelaywaits for the real content.