SDKs

Single-file clients for Python and Node with no dependencies. Download one next to your code, or use any HTTP client: the API is plain GET and POST.

Install

curl -O https://shotlane.dev/sdk/shotlane.py    # Python 3.8+, standard library only
curl -O https://shotlane.dev/sdk/shotlane.mjs   # Node 18+, Deno, Bun

Python

from shotlane import Shotlane, ShotlaneError, sign_url, verify_webhook

sl = Shotlane("sl_your_key")
open("page.png", "wb").write(sl.screenshot("https://example.com", full_page=True, device="iphone"))
open("invoice.pdf", "wb").write(sl.pdf(html="<h1>Invoice #42</h1>", page_numbers=True))
text = sl.markdown("https://react.dev/learn")
report = sl.check("https://your-site.com", devices=["iphone", "desktop"])
job = sl.crawl("https://docs.python.org/3/tutorial/", limit=20)    # waits for the ZIP
sl.create_monitor("https://example.com/pricing", kind="markdown", interval="daily")

try:
    sl.screenshot("https://example.com", selector="#missing")
except ShotlaneError as e:
    print(e.status, e)            # 422 Selector not found or not visible: #missing

Node, Deno and Bun

import { Shotlane, signUrl, verifyWebhook } from "./shotlane.mjs";

const sl = new Shotlane(process.env.SHOTLANE_API_KEY);
const png = await sl.screenshot("https://example.com", { full_page: true });   // Buffer
const pdf = await sl.pdf({ markdown: "# Report\n\nHello" }, { page_numbers: true });
const md = await sl.markdown("https://react.dev/learn");                       // string
const report = await sl.check("https://your-site.com", ["iphone", "desktop"]);

Methods

Both clients have the same methods, named after the endpoints: screenshot, pdf, markdown, extract, screenshots, check, animate, report, map, scrape, crawl, bulk, the monitor methods, account, usage and devices, plus render_async / renderAsync (an async render that waits for the result by default) and render_status / renderStatus. Every option from these docs is a keyword argument (Python) or a field of the options object (Node). Errors raise ShotlaneError with the HTTP status; the last response's headers are in last_headers / lastHeaders.

sign_url / signUrl build signed URLs, and verify_webhook / verifyWebhook check webhook signatures.

Other languages: the OpenAPI spec works with any OpenAPI generator, and every endpoint is one HTTP request.