Screenshot API for Go
Capture website screenshots in Go without headless Chrome or any browser dependency. One HTTP call. Get back an image.
Quick Start
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
)
func main() {
params := url.Values{
"url": {"https://stripe.com"},
"format": {"png"},
"width": {"1280"},
"frame": {"macbook"},
"key": {"YOUR_API_KEY"},
}
resp, err := http.Get("https://grabshot.dev/v1/screenshot?" + params.Encode())
if err != nil { panic(err) }
defer resp.Body.Close()
f, _ := os.Create("screenshot.png")
defer f.Close()
io.Copy(f, resp.Body)
fmt.Println("Saved screenshot.png")
}
HTTP Handler
func screenshotHandler(w http.ResponseWriter, r *http.Request) {
target := r.URL.Query().Get("url")
params := url.Values{
"url": {target}, "format": {"png"},
"width": {"1280"}, "key": {os.Getenv("GRABSHOT_KEY")},
}
resp, err := http.Get("https://grabshot.dev/v1/screenshot?" + params.Encode())
if err != nil { http.Error(w, "capture failed", 500); return }
defer resp.Body.Close()
w.Header().Set("Content-Type", "image/png")
w.Header().Set("Cache-Control", "public, max-age=3600")
io.Copy(w, resp.Body)
}
Start capturing screenshots in Go
25 free screenshots per month. No credit card required.
Get Free API Key →