FAQ · Testing & CI/CD

Can I use a Screenshot API for visual regression testing?

Yes — and it is one of the most popular Screenshot API use cases. Call a /diff endpoint with two URLs. The API renders both pages, runs pixel-level comparison, and returns a diff PNG plus a similarity score — no Percy, no BackstopJS, no local snapshot runner.

How it works in one HTTP call

GET https://api.snapshotflow.com/diff
  ?baseline=https://main.my-app.com
  &compare=https://staging.my-app.com

The API responds with:

  • A diff PNG with pixel differences highlighted in red
  • A similarity score between 0.0 (completely different) and 1.0 (identical)
  • A pixel count of changed areas

Your CI pipeline just needs to check if similarity >= 0.99 (or whatever threshold you define) to pass or fail the build step.

Advantages over Percy, BackstopJS, and Playwright snapshots

  • Zero infra. No Puppeteer, no Docker, no CI browser installation. One HTTP call from any language or pipeline step.
  • Cross-environment. Compare your staging URL against your production URL — no need to share a baseline snapshot file between CI agents.
  • Always fresh renders. Both sides are rendered live at comparison time, eliminating stale baseline drift issues.
  • Language-agnostic. Works from bash, Node.js, Python, GitHub Actions, or any HTTP client.

GitHub Actions example

- name: Visual regression check
  run: |
    SCORE=$(curl -s "https://api.snapshotflow.com/diff\
      ?baseline=https://main.my-app.com\
      &compare=$STAGING_URL" \
      -H "X-Api-Key: $SNAPSHOTFLOW_KEY" | jq '.similarity')
    echo "Similarity: $SCORE"
    [ "$(echo "$SCORE >= 0.99" | bc)" -eq 1 ] || exit 1

Add visual regression to your CI pipeline

SnapshotFlow's /diff endpoint is CI-ready and uses the same free tier — 200 comparisons per month with no credit card.

← Back to all FAQ