API Documentation

Authentication

All API endpoints require an API key. Pass it via the x-api-key header or key query parameter.

curl -H "x-api-key: ds_your_key_here" https://diffshot.grabshot.dev/v1/screenshot?url=https://example.com

POST /v1/diff

Compare two URLs or a URL against a baseline image.

Request Body (JSON)

url1 + url2 — Two URLs to compare
OR
url + baseline — URL + base64 PNG baseline image
width (optional) — Viewport width, default 1280
height (optional) — Viewport height, default 800

Example

curl -X POST "https://diffshot.grabshot.dev/v1/diff" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url1":"https://example.com","url2":"https://example.org"}'

Response

{
  "success": true,
  "diff": {
    "diffPercent": 42.5,
    "changedPixels": 435200,
    "totalPixels": 1024000,
    "width": 1280,
    "height": 800,
    "diffImage": "data:image/png;base64,..."
  }
}

GET /v1/screenshot

Take a screenshot of a URL. Useful for creating baselines.

Parameters

url (required) — URL to screenshot
width (optional) — Viewport width, default 1280
height (optional) — Viewport height, default 800
curl "https://diffshot.grabshot.dev/v1/screenshot?url=https://example.com" \
  -H "x-api-key: YOUR_KEY"

GET /v1/demo/diff

No-auth demo endpoint. Compares two example URLs.

curl "https://diffshot.grabshot.dev/v1/demo/diff"

GET /v1/health

Health check. No auth required.

curl "https://diffshot.grabshot.dev/v1/health"

User Management

POST /v1/register — Register with {"email":"..."}
POST /v1/login — Login with {"key":"ds_..."}
GET /v1/account — Get account info (auth required)
GET /v1/keys — List API keys (auth required)
POST /v1/keys — Create new API key (auth required)
DELETE /v1/keys/:id — Revoke an API key (auth required)