Website screenshots & PDFs in Go

Keep your Go binary small and static. No chromedp and no browser in the container, just net/http.

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

package main

import (
	"io"
	"net/http"
	"net/url"
	"os"
)

func main() {
	q := url.Values{"url": {"https://example.com"}, "full_page": {"true"}}
	req, _ := http.NewRequest("GET", "https://shotmint.creasework.com/v1/screenshot?"+q.Encode(), nil)
	req.Header.Set("X-API-Key", os.Getenv("SHOTMINT_KEY"))
	res, err := http.DefaultClient.Do(req)
	if err != nil || res.StatusCode != 200 {
		panic("render failed")
	}
	defer res.Body.Close()
	f, _ := os.Create("shot.png")
	defer f.Close()
	io.Copy(f, res.Body)
}

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

body := strings.NewReader(`{"html":"<h1>Invoice #42</h1>","format":"A4"}`)
req, _ := http.NewRequest("POST", "https://shotmint.creasework.com/v1/pdf", body)
req.Header.Set("X-API-Key", os.Getenv("SHOTMINT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
// stream res.Body to a file or an http.ResponseWriter

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.

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