Docs
Compare Snapshots

Compare Snapshots

Measure visual differences between two completed snapshots.

Endpoint

GET /api/v1/snapshots/compare

Query Parameters

NameTypeRequiredDescription
baselinestring (CUID)YesSnapshot captured from the reference environment.
targetstring (CUID)YesSnapshot captured from the environment under test.
timeoutinteger (ms)No (30000 default)Maximum wait time for each snapshot to complete before returning.

Example Request

curl -s \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.watchero.io/api/v1/snapshots/compare?baseline=cmhdg7bc30002to6kw8vlrf0s&target=cmhdg7gj10006to6krkwwasp0&timeout=120000"

Example Response

{
  "layoutDisturbanceScore": 0.508117872836975,
  "visualDisturbanceScore": 0.48266061546495,
  "fontDisturbanceScore": 0.0286352262032319,
  "overallDisturbanceScore": 0.33980490843571995,
  "details": [
    {
      "urls": {
        "baseline": "https://site.com/preview/",
        "target": "https://site.com/"
      },
      "viewport": {
        "width": 360,
        "height": 640,
        "deviceScaleFactor": 1
      },
      "screenshots": {
        "baseline": "https://watchero.io/storage/.../baseline.png",
        "target": "https://watchero.io/storage/.../target.png",
        "diff": "https://watchero.io/storage/.../diff.png"
      },
      "nodesAdded": 0,
      "nodesRemoved": 0,
      "visualDisturbanceScore": 0.48266061546495,
      "layoutDisturbanceScore": 0.508117872836975,
      "fontDisturbanceScore": 0.0286352262032319
    }
  ]
}

Scores are summed across matching URLs and viewports. The API returns 400 if either snapshot is still queued, 404 when a snapshot is missing, and 422 when a snapshot finished in an error state. All values use a 0.0 – 1.0 range where lower scores indicate closer pixel parity. For production use, prioritize visualDisturbanceScore + fontDisturbanceScore as the primary quality gate.


We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking Accept, you agree to our use of cookies.
Learn more.