SXScreenshotX

Docs

ScreenshotX is a developer-first screenshot API. It supports multi-layer caching (KV → R2 → Rendering), batch jobs, and a production-ready security posture.

Authentication

Use a Bearer API key:

Authorization: Bearer sx_live_...

Create a screenshot

Endpoint: POST /api/v1/screenshot

curl -X POST $API_BASE_URL/api/v1/screenshot \
  -H "Authorization: Bearer sx_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "viewport": { "width": 1280, "height": 720 },
    "format": "png",
    "fullPage": false,
    "cache": true,
    "cacheTTL": 86400
  }'

Successful responses return a CDN URL like /screenshots/....

Batch screenshots

Endpoint: POST /api/v1/screenshot/batch

curl -X POST $API_BASE_URL/api/v1/screenshot/batch \
  -H "Authorization: Bearer sx_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://example.com", "https://example.org"],
    "options": { "viewport": { "width": 1280, "height": 720 }, "format": "png" },
    "priority": "normal"
  }'

Query progress via GET /api/v1/batch/:batchId or stream updates with SSE GET /api/v1/batch/:batchId/stream.

Errors

Errors use a consistent envelope: { success:false, error:{code,message} }. Common codes include unauthorized, rate_limited, and render_failed.