FAQ · Updated October 13, 2026
Can I use a Screenshot API for visual regression testing?
Yes. Call /diff with before and after page URLs, and use response_type=json to read diff_percent, changed_pixels, and total_pixels. Choose response_type=base64 when you want the diff image together with change statistics. Keep the viewport consistent and decide what percentage of changed pixels should fail your CI check. This endpoint renders both URLs; it does not accept a saved baseline image in place of a page URL.
Compare two live page URLs
Use before and after with the /diff endpoint. It renders both page URLs and compares their pixels. It does not accept a previously saved image as the baseline. Set identical viewport dimensions for a meaningful comparison.
GET /diff?before=https://example.com&after=https://preview.example.com&width=1280&height=800&response_type=json
Read the actual response fields
A JSON response includes diff_percent, changed_pixels, total_pixels, and has_changes. Zero percent means no changed pixels. The threshold parameter controls pixel sensitivity; your CI workflow separately chooses the acceptable percentage of changed pixels. Use response_type=image for the diff PNG or base64 for the image plus change statistics.
Example CI check
set -eu
curl --fail-with-body -sS -G "https://api.snapshotflow.com/diff" -H "X-Api-Key: $SNAPSHOTFLOW_KEY" --data-urlencode "before=https://main.example.com" --data-urlencode "after=$STAGING_URL" --data-urlencode "response_type=json" --output diff.json
jq -e '(.diff_percent | type == "number") and (.diff_percent <= 1)' diff.jsonThis example permits up to 1% changed pixels. Choose a threshold appropriate to your page and control rotating content to reduce noisy results.
Quota and limitations
A successful diff uses two screenshot units. This endpoint exposes viewport dimensions and a pixel threshold, rather than all of the cookies, selectors, and timing options on the screenshot endpoint. Use reachable page variants suitable for comparison; for stored-image comparisons, capture the images separately and compare them in your own workflow.