Getting started
Quick start
shotsmith renders web pages in Chrome and returns them as images, PDFs, videos, HTML or Markdown. Every call is a single HTTP request.
1. Get a key
Create an account. Your first access key and secret are on the API keys page. The free plan includes 100 successful renders a month.
2. Make a request
Pass your access key and a URL to /v1/take. The response body is the file.
// npm install @shotsmith/sdk
import { Shotsmith, TakeOptions } from '@shotsmith/sdk';
import { writeFile } from 'node:fs/promises';
const shotsmith = new Shotsmith({
accessKey: 'YOUR_ACCESS_KEY',
});
const options = TakeOptions.url('https://shotsmith.dev/sample')
.format('png');
await writeFile('capture.png', await shotsmith.take(options));
<?php
// composer require shotsmith/shotsmith-php
require 'vendor/autoload.php';
use Shotsmith\Client;
use Shotsmith\Options\TakeOptions;
$shotsmith = new Client('YOUR_ACCESS_KEY');
$options = TakeOptions::url('https://shotsmith.dev/sample')
->format('png');
file_put_contents('capture.png', $shotsmith->take($options));
// In Laravel: Shotsmith::take($options) with SHOTSMITH_ACCESS_KEY in .env
curl -G "https://shotsmith.dev/v1/take" \ --data-urlencode "access_key=YOUR_ACCESS_KEY" \ --data-urlencode "url=https://shotsmith.dev/sample" \ --data-urlencode "format=png" \ -o capture.png
import { writeFile } from 'node:fs/promises';
const params = new URLSearchParams({
access_key: 'YOUR_ACCESS_KEY',
url: 'https://shotsmith.dev/sample',
format: 'png',
});
const res = await fetch(`https://shotsmith.dev/v1/take?${params}`);
if (!res.ok) throw new Error((await res.json()).error_message);
await writeFile('capture.png', Buffer.from(await res.arrayBuffer()));
import urllib.request
from urllib.parse import urlencode
params = {
"access_key": "YOUR_ACCESS_KEY",
"url": "https://shotsmith.dev/sample",
"format": "png"
}
url = "https://shotsmith.dev/v1/take?" + urlencode(params, doseq=True)
# Raises urllib.error.HTTPError on a 4xx/5xx response
with urllib.request.urlopen(url, timeout=120) as res, open("capture.png", "wb") as f:
f.write(res.read())
<?php
$query = http_build_query([
'access_key' => 'YOUR_ACCESS_KEY',
'url' => 'https://shotsmith.dev/sample',
'format' => 'png',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://shotsmith.dev/v1/take?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status !== 200) {
throw new RuntimeException(json_decode($body, true)['error_message'] ?? "HTTP {$status}");
}
file_put_contents('capture.png', $body);
package main
import (
"io"
"net/http"
"os"
)
func main() {
res, err := http.Get("https://shotsmith.dev/v1/take?access_key=YOUR_ACCESS_KEY&url=https%3A%2F%2Fshotsmith.dev%2Fsample&format=png")
if err != nil {
panic(err)
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
body, _ := io.ReadAll(res.Body)
panic(string(body))
}
out, err := os.Create("capture.png")
if err != nil {
panic(err)
}
defer out.Close()
io.Copy(out, res.Body)
}
require "net/http"
require "uri"
uri = URI("https://shotsmith.dev/v1/take")
uri.query = URI.encode_www_form([
["access_key", "YOUR_ACCESS_KEY"],
["url", "https://shotsmith.dev/sample"],
["format", "png"]
])
res = Net::HTTP.get_response(uri)
raise res.body unless res.is_a?(Net::HTTPSuccess)
File.binwrite("capture.png", res.body)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
public class Capture {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder(URI.create(
"https://shotsmith.dev/v1/take?access_key=YOUR_ACCESS_KEY&url=https%3A%2F%2Fshotsmith.dev%2Fsample&format=png"
)).build();
var res = client.send(request, HttpResponse.BodyHandlers.ofFile(Path.of("capture.png")));
if (res.statusCode() != 200) {
throw new RuntimeException("HTTP " + res.statusCode());
}
}
}
using System;
using System.IO;
using System.Net.Http;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(120) };
// Throws HttpRequestException on a 4xx/5xx response
var bytes = await http.GetByteArrayAsync(
"https://shotsmith.dev/v1/take?access_key=YOUR_ACCESS_KEY&url=https%3A%2F%2Fshotsmith.dev%2Fsample&format=png"
);
await File.WriteAllBytesAsync("capture.png", bytes);
Content-Type: image/png
X-Capture-Id: 01m8kvpk6jsmeykdfs0wy6awbn
X-Cache: MISS
X-Render-Time: 296
X-Quota-Limit: 15000
X-Quota-Remaining: 14998
X-RateLimit-Limit: 80
X-RateLimit-Remaining: 79
(the PNG image)
Every option works as a query parameter (GET), a form field, or a JSON body key (POST). Repeat a parameter to send a list, for example hide_selectors=.banner&hide_selectors=#chat.
3. Shape the result
Some combinations most people use:
full_page=truefor the whole length of the page.block_cookie_banners=true&block_ads=true&block_chats=truefor clean shots.viewport_device=iphone_15_profor mobile.GET /v1/deviceslists all presets.format=pdf&pdf_print_background=truefor print-ready PDFs.response_type=json&metadata_page_title=true&metadata_open_graph=truefor a file URL plus page metadata.
The option reference lists all 134 options. The playground builds requests for you and generates code.
4. Handle errors
Errors return JSON with a stable error_code, a message saying what to change, and the HTTP status. Failed renders are never billed.
{
"is_successful": false,
"error_code": "selector_not_found",
"error_message": "selector \"#pricing\" was not found."
}
Other endpoints
| Endpoint | Purpose |
|---|---|
| GET|POST /v1/take | Screenshot, PDF, HTML or Markdown |
| GET|POST /v1/animate | Scrolling video or GIF |
| POST /v1/bulk | Up to 100 captures with shared options |
| GET /v1/captures/{id} | Status and file URL of a capture |
| GET /v1/captures | List captures, filter by status, batch or external_identifier |
| GET|POST|DELETE /v1/monitors | Manage page monitors |
| GET /v1/usage | Quota and daily usage this month |
| GET /v1/devices | Device presets for viewport_device |
Base URL: https://shotsmith.dev