How do I monitor a web page for changes?
Create a monitor with POST /v1/monitors, as in the example above: the screenshot parameters, how often to check and where to send alerts. Shotfly captures the page on that schedule, compares it with the previous check, and sends a monitor.changed webhook when the pixels or the visible text changed. A receiver that checks the signature:
import { createHmac, timingSafeEqual } from 'node:crypto'
import { createServer } from 'node:http'
const secret = process.env.SHOTFLY_SECRET_KEY // the secret of the key that created the monitor
/** rawBody is the request body as bytes, exactly as received. */
function verify(rawBody, header) {
const { t, v1 } = Object.fromEntries(header.split(',').map((part) => part.split('=')))
if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false
const expected = createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest()
const given = Buffer.from(v1, 'hex')
return given.length === expected.length && timingSafeEqual(given, expected)
}
createServer(async (req, res) => {
const chunks = []
for await (const chunk of req) chunks.push(chunk)
const raw = Buffer.concat(chunks)
if (!verify(raw, req.headers['x-shotfly-signature'] ?? '')) return res.writeHead(401).end()
const event = JSON.parse(raw.toString('utf8'))
if (event.type === 'monitor.changed') {
const d = event.data
console.log(`${d.monitor_name} changed: ${d.url}`)
console.log('changed pixels:', d.diff_ratio, 'text changed:', d.text_changed)
console.log('diff image, valid for 7 days:', d.diff_image)
}
res.writeHead(204).end()
}).listen(3000)How does Shotfly decide that a page changed?
Each check is compared with the last successful one. A change is reported when the share of changed pixels reaches diff_threshold (default 0.01, which is 1% of the pixels) or when the visible text differs. Runs that changed come with a diff image: the earlier screenshot faded, changed pixels in red.
Clocks, visitor counters, rotating ads and carousels change on every load. Add their CSS selectors to hide_selectors in params, or every check will report a change.
What happens when the site blocks a check?
Bot challenges and blank pages are recorded on the run but never compared, so they never raise a change alert, and they cost nothing. The next successful check is compared with the last good screenshot.
How often can a monitor run, and what does it cost?
| Plan | Monitors | Shortest interval |
|---|---|---|
| Free | 1 | daily |
| Starter | 5 | hourly |
| Growth | 25 | every 15 min |
| Pro | 100 | every 5 min |
A successful check costs the same as the equivalent screenshot request: 1 credit with default routing, more with geo or the premium anti-bot tier. Blocked and blank checks cost nothing.
Can I prove what a page showed on a given date?
Turn on archives, and every successful check also stores an MHTML snapshot and a manifest.json with the SHA-256 of each file, plus an RFC 3161 timestamp (timestamp.tsr) you can check with openssl ts -verify. Archives can go to your own S3-compatible bucket, with S3 Object Lock if the bucket has it enabled; archives in Shotfly storage are deleted after one year. See monitors and archives.
What are the limits?
GET /v1/monitors/:idreturns the last 50 runs.- Run screenshots and diff images are kept for 90 days; the record of each run stays.
- Links in a
monitor.changedwebhook are valid for 7 days. - Pages behind a login need
cookiesorheadersinparams, and those sessions expire.


