Getting Started

Everything you need to capture your first screenshot in under a minute.

Authentication

All API requests require an API key passed in the X-API-Key header. You can get a free API key by signing up at getsnap.dev.

X-API-Key: sk_live_YOUR_API_KEY
Note: Your API key starts with sk_live_ for production or sk_test_ for testing. Keep your key secret — never expose it in client-side code.

Your First Request

Capture a screenshot with a single POST request:

curl -X POST https://api.getsnap.dev/v1/screenshot \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "png"
  }'

That's it. The API returns a CDN URL to your screenshot:

{
  "url": "https://getsnap-screenshots.fra1.cdn.digitaloceanspaces.com/screenshots/a1b2c3d4/req_xyz123.png",
  "cached": false,
  "request_id": "req_xyz123",
  "response_time_ms": 2340
}

Response Format

By default, the API uploads the screenshot to CDN and returns a URL. You can also get the raw binary:

URL Response (default)

Set "response_type": "url" (or omit it). Returns a JSON object with the CDN URL. The screenshot is stored for 24 hours.

Binary Response

Set "response_type": "binary". Returns the raw image/PDF bytes directly with the appropriate Content-Type header.

Response Headers

Every response includes helpful headers:

HeaderDescription
X-Request-IdUnique request identifier for debugging
X-CacheHIT if served from cache, MISS if freshly captured
X-Credits-RemainingScreenshots remaining in your billing period
X-Response-TimeServer processing time

Rate Limits

Rate limits are applied per API key using a sliding window. When exceeded, the API returns 429 Too Many Requests.

PlanRequests/minMonthly Screenshots
Free5100
Starter305,000
Pro6025,000
Business120100,000

Error Handling

All errors return a consistent JSON structure:

{
  "error": "error_code",
  "message": "Human-readable description",
  "request_id": "req_xyz123"
}

Common Error Codes

StatusCodeMeaning
400validation_errorInvalid request body or parameters
401unauthorizedMissing or invalid API key
402quota_exceededMonthly screenshot limit reached
429rate_limitedToo many requests per minute
500capture_failedScreenshot capture failed (timeout, invalid URL, etc.)
Tip: Always check for 402 responses in production. Implement exponential backoff for 429 responses.

Caching

Identical requests (same URL + same options) are automatically cached for 24 hours. Cached responses are free and don't count against your quota. Check the X-Cache: HIT header to confirm a cached response.

Base URL

https://api.getsnap.dev

All endpoints are versioned under /v1/. When we release breaking changes, we'll increment the version and keep old versions running for at least 12 months.