Website screenshots & PDFs in PHP

No wkhtmltopdf binaries and no Puppeteer sidecar. Plain cURL (or Guzzle) gets you a screenshot or PDF.

1. Get an API key

Click Get free key. You get 100 free renders instantly, no account needed. Store the key in an environment variable called SHOTMINT_KEY.

2. Screenshot a URL

<?php
$query = http_build_query(['url' => 'https://example.com', 'full_page' => 'true']);
$ch = curl_init("https://shotmint.creasework.com/v1/screenshot?$query");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('SHOTMINT_KEY')],
    CURLOPT_TIMEOUT => 60,
]);
$png = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) die("Render failed: $png");
file_put_contents('shot.png', $png);

Useful parameters: full_page=true for the whole scrollable page, width/height for the viewport, device_scale_factor=2 for retina, selector to capture a single element, dark_mode=true, and hide_selectors to remove cookie banners. See the full list.

3. Turn HTML into a PDF

<?php
$ch = curl_init("https://shotmint.creasework.com/v1/pdf");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('SHOTMINT_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode(['html' => '<h1>Invoice #42</h1>', 'format' => 'A4']),
]);
file_put_contents('invoice.pdf', curl_exec($ch));

PDF options include format (A4, Letter…), landscape, margin, and print_background. You can pass a url instead of html.

Errors & credits

A failed render never costs a credit. Status 400 means bad input or an unreachable URL, 402 means you're out of credits, and 429/503 mean you should retry with backoff. Every successful response includes an X-Credits-Remaining header.

Notes for PHP

In Laravel: Http::withHeaders(['X-API-Key' => env('SHOTMINT_KEY')])->post($url, ['html' => view('invoice', $data)->render()])->body().

Try it with 100 free renders

No signup, no card. Get a key in one click, then buy credits only if you need more (from €5 for 2,000, never expire).

Get a free API key Full API reference