Keep your Go binary small and static. No chromedp and no browser in the container, just net/http.
Click Get free key. You get 25 free renders a month instantly, no account needed. Store the key in an environment variable called SHOTMINT_KEY.
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.
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.
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, and screenshots and PDFs of a URL also carry X-Page-Status: the HTTP status the site answered with. A 403 there usually means you captured the site's bot-protection page, a 404 its error page.
The quickstart above stops at the first error. In production you want three more things: retry only the failures that can fix themselves (503 when the renderer is busy, network timeouts), never retry a 400 or 402, and warn when the site itself answered with an error page. This script does all three for screenshots and PDFs, and prints the credits left after each call:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"strconv"
"time"
)
const api = "https://shotmint.creasework.com"
var client = &http.Client{Timeout: 90 * time.Second}
// render retries only what is worth retrying: 503 (renderer busy) and network errors.
// A 400 (bad input, unreachable site) or 402 (no credits) will not fix itself.
func render(path string, params map[string]any) ([]byte, error) {
body, _ := json.Marshal(params)
var lastErr error
for i := 0; i < 3; i++ {
if i > 0 {
time.Sleep(time.Duration(1<<(i-1)) * time.Second)
}
req, _ := http.NewRequest("POST", api+path, bytes.NewReader(body))
req.Header.Set("X-API-Key", os.Getenv("SHOTMINT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
lastErr = err
continue
}
data, err := io.ReadAll(res.Body)
res.Body.Close()
if err != nil {
lastErr = err
continue
}
switch res.StatusCode {
case 200:
if page, _ := strconv.Atoi(res.Header.Get("X-Page-Status")); page >= 400 {
log.Printf("site answered %d: you may have captured an error or bot page", page)
}
log.Printf("credits left: %s", res.Header.Get("X-Credits-Remaining"))
return data, nil
case 503:
lastErr = fmt.Errorf("renderer busy")
default:
var e struct{ Error string }
json.Unmarshal(data, &e)
return nil, fmt.Errorf("%d: %s", res.StatusCode, e.Error)
}
}
return nil, lastErr
}
func main() {
png, err := render("/v1/screenshot", map[string]any{"url": "https://en.wikipedia.org/wiki/Go_(programming_language)", "full_page": true})
if err != nil {
log.Fatal(err)
}
os.WriteFile("shot.png", png, 0o644)
pdf, err := render("/v1/pdf", map[string]any{"url": "https://example.com", "format": "A4"})
if err != nil {
log.Fatal(err)
}
os.WriteFile("page.pdf", pdf, 0o644)
}http.DefaultClient has no timeout, so one stalled connection blocks that goroutine forever: give the client a Timeout. The request is rebuilt on every attempt because the first Do consumes the body reader, and the body is read in full before the status check, so a broken connection mid-download is retried too.
Timing, measured on 2026-10-25: a full-page capture of a long Wikipedia article plus an A4 PDF took 8.5 to 25 s end to end, so keep the read timeout well above 30 s. Full-page captures are capped at 16,000 px tall (the Go and PHP articles hit that cap). With a format the API doesn't support, the script stops at once with the API's own message: 400: format must be png, jpeg or webp (got "gif").
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). From a script, an AI agent, Make or Zapier, POST /v1/keys/free (no body) returns a key as JSON (openapi.json, no-code recipes).
All guides: guides · integrations · comparisons