Skip to main content

Change events & webhooks

Everything that happens to a watch becomes an event. Each event has a UUID id and a sequence number that increases across your account. Netscrape pushes events to your webhook and keeps them in a feed you can read at any time. Use either, or both: webhooks for speed, plus a regular sweep of the feed to catch anything missed.

Event types

Type Sent when
watch.changed The page changed (and the change was confirmed, if confirmation applies). The first successful read sends one too, as version 1.
watch.health_changed The watch's health moved, for example healthy to failing.
watch.moved A read ended on a permanent redirect. Says whether the watch followed it.
watch.noisy The watch flipped between versions three times in ten checks without a change holding.
watch.checked A delivered check finished, or any check finished on a watch with emit_checks: true.

Every event has these fields:

{
  "id": "0a670d22-0010-4713-bd84-15105ca681a7",
  "sequence": 4,
  "type": "watch.changed",
  "at": "2026-11-14T08:46:15.718997Z",
  "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]}
}

watch.changed

{
  "id": "0a670d22-0010-4713-bd84-15105ca681a7",
  "sequence": 4,
  "type": "watch.changed",
  "at": "2026-11-14T08:46:15.718997Z",
  "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
  "check": {"id": "c0d933dc-9802-4e6d-bd06-31a0d5db21fd", "job_id": "84994c2c-0502-4322-aaff-b468c2a463ca", "at": "2026-11-14T08:46:15.718997Z", "status": 200},
  "before": {
    "version": 1,
    "fingerprint": "ffadfb575da1f4732d52d5102d136dab523f095d98c0ba400e808c61ed8ffcfe",
    "compare_hash": "ffadfb575da1f4732d52d5102d136dab523f095d98c0ba400e808c61ed8ffcfe",
    "content_hash": "646b54bc0aa91a20607ffb222e039ba93815a70c94072398eea009f23a7fd6cb",
    "text_hash": "8d0c3f6b1a9e4d27c5b8f01e6a3d92c47b5e10f8a26c9d3e7f4b81a05c6d2e93",
    "values": {},
    "extract_empty": false,
    "job_id": "45ef34a0-9648-4240-b752-b89368298eaf",
    "read_at": "2026-11-13T11:10:15.689047Z",
    "result_url": "/v1/jobs/45ef34a0-9648-4240-b752-b89368298eaf/result",
    "result_expires_at": "2026-11-20T11:10:15.664934Z",
    "payload_expired": false
  },
  "after": {
    "version": 2,
    "fingerprint": "282e4f317485b6200782eb438730a04231f2f08a11db8b8cf0a8b6a1a02b5b17",
    "compare_hash": "282e4f317485b6200782eb438730a04231f2f08a11db8b8cf0a8b6a1a02b5b17",
    "content_hash": "19fd9d6e67ef44bc6627596ef527d16ad2ef02439db44e7183a5b3a9ee76c103",
    "text_hash": "3e9a71c0d4b2f58e6a1c07d93b4f2e85a6c1d07b9e3f42a8d5c60b1e7f9a2d34",
    "values": {},
    "extract_empty": false,
    "job_id": "84994c2c-0502-4322-aaff-b468c2a463ca",
    "read_at": "2026-11-14T08:46:15.718997Z",
    "result_url": "/v1/jobs/84994c2c-0502-4322-aaff-b468c2a463ca/result",
    "result_expires_at": "2026-11-21T08:46:15.712792Z",
    "payload_expired": false
  },
  "diff": {
    "kind": "lines",
    "added": 2,
    "removed": 1,
    "hunks": [
      {"op": "del", "text": "Lamp B - 55"},
      {"op": "ins", "text": "Lamp B - 60\nLamp C - 75"}
    ],
    "truncated": false
  },
  "reversal": false,
  "earlier_version": null,
  "confirmed": false
}

watch.health_changed

{
  "id": "6c2b1e0a-77f4-4c1d-9a3b-2f8e5d4c1b09",
  "sequence": 7,
  "type": "watch.health_changed",
  "at": "2026-11-18T03:12:40.104512Z",
  "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
  "from": "healthy",
  "to": "blocked",
  "reason": "challenge:siteground",
  "evidence": {"kind": "blocked", "reason": "challenge:siteground", "status": 202, "challenge": "siteground", "robots_rule": null},
  "check": {"id": "4b1f7c2e-0d3a-4e58-b9c6-1a2d3e4f5a6b", "job_id": "1d2c3b4a-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "at": "2026-11-18T03:12:40.104512Z", "status": 202}
}

reason is the error code or http_<status>, or challenge:<vendor>. Events that come from Netscrape itself rather than a read carry no check: a refused submission has evidence.stage: "submission", re-enrolment has reason reenrolled, and robots.txt allowing a page again has reason robots_allowed.

watch.moved

{
  "id": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
  "sequence": 9,
  "type": "watch.moved",
  "at": "2026-11-19T10:02:11.551203Z",
  "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
  "from": "https://example.com/catalogue",
  "to": "https://example.com/products",
  "followed": true,
  "check": {"id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d", "job_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e"}
}

watch.checked

{
  "id": "f0394eb7-dff5-4826-9191-4b6e81bb4655",
  "sequence": 3,
  "type": "watch.checked",
  "at": "2026-11-13T11:10:15.689047Z",
  "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
  "check": {"id": "c14c8e51-de4d-464d-8e09-a044893b191a", "job_id": "45ef34a0-9648-4240-b752-b89368298eaf", "at": "2026-11-13T11:10:15.689047Z", "status": 200},
  "delivered": true,
  "changed": false,
  "outcome": "unchanged",
  "superseded": false,
  "fingerprint": "ffadfb575da1f4732d52d5102d136dab523f095d98c0ba400e808c61ed8ffcfe",
  "job_id": "45ef34a0-9648-4240-b752-b89368298eaf",
  "result_url": "/v1/jobs/45ef34a0-9648-4240-b752-b89368298eaf/result",
  "result_expires_at": "2026-11-20T11:10:15.664934Z",
  "payload_expired": false
}

outcome is one of:

Outcome Meaning
changed A new version was recorded
unchanged Same as the current version
unconfirmed Different, waiting for a confirmation (a re-read, or your next attached job for a manual watch); changed is false until it agrees
flapping The confirmation re-read disagreed
superseded The watch was paused, retired or edited while the read was in flight
failing, gone, blocked, robots_disallowed The read counted toward that health
service_error Netscrape's own fault, or a followed move; it doesn't count against the page
evaluation_error Netscrape couldn't evaluate the read

watch.noisy

Carries the check that tipped it over. The watch's noisy flag clears once fewer than three of its last ten checks flipped.

Webhooks

Webhooks go to your account's HTTPS URL, signed with your account's secrets. Both are set on your account rather than through the API: in your account's webhook settings, or with your access request. The URL must be HTTPS without credentials, and its host must resolve only to public addresses. Redirects aren't followed.

Each event is a POST with the event as its JSON body and these headers:

content-type: application/json
user-agent: Netscrape-Webhooks/1
x-netscrape-event: watch.changed
x-netscrape-delivery: 0a670d22-0010-4713-bd84-15105ca681a7
x-netscrape-signature: t=1794645975,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd

Answer with any 2xx status within 10 seconds. Anything else is retried.

To check your endpoint, send a test delivery from your account's webhook settings. It's signed like any other, with x-netscrape-event: webhook.test and the body {"event": "webhook.test", "id": "...", "created_at": "..."}. It isn't an event: it has no sequence, isn't retried and never appears in the feed.

Verifying signatures

x-netscrape-signature holds a Unix timestamp t and one v1 per secret on your account, so you can rotate secrets without missing a delivery. Each v1 is the lowercase hex HMAC-SHA256 of <t>.<body> under one secret, where <body> is the raw request body. Accept a delivery if any v1 matches one of your secrets and t is within five minutes of now.

import hashlib, hmac, time

def verify(secret: str, header: str, body: bytes, tolerance: int = 300) -> bool:
    parts = [part.split("=", 1) for part in header.split(",")]
    if len(parts) < 2 or parts[0][0] != "t":
        return False
    timestamp = parts[0][1]
    if abs(time.time() - int(timestamp)) > tolerance:
        return False
    expected = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
    return any(key == "v1" and hmac.compare_digest(value, expected) for key, value in parts[1:])
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(secret, header, body, tolerance = 300) {
  const parts = header.split(",").map((part) => part.split("="));
  if (parts.length < 2 || parts[0][0] !== "t") return false;
  const timestamp = parts[0][1];
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > tolerance) return false;
  const expected = createHmac("sha256", secret).update(`${timestamp}.`).update(body).digest("hex");
  return parts.slice(1).some(([key, value]) =>
    key === "v1" && value.length === expected.length &&
    timingSafeEqual(Buffer.from(value), Buffer.from(expected)));
}

Verify against the raw body bytes, before any JSON parsing.

Retries

Idempotency and order

A delivery can arrive more than once, and deliveries can arrive out of order.

The event feed

curl "https://netscrapehq.com/v1/events?after=4&limit=100&types=watch.changed,watch.health_changed&label=catalogue" \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY"
Parameter Meaning
after Return events with a higher sequence. Omit to start at the retention floor.
limit 1–500, default 100.
types Comma-separated event types.
label Only events for watches with this label.
{
  "data": [],
  "next_cursor": 4,
  "has_more": false,
  "webhook_status": "healthy"
}

Events come in sequence order. Process the page, then store next_cursor and pass it as after next time. Store it even when data is empty: with filters, the cursor still moves past events you didn't ask for. While has_more is true, read again straight away.

The feed keeps 30 days of events. A cursor older than that returns 410 cursor_expired:

{"error": {"code": "cursor_expired"}, "next_cursor": 912}

Save that next_cursor, resync the watches you need, then read on from the saved cursor.

Resync and recovery

Events are the history; fresh reads are how you get page content back. Page bodies are kept for seven days, events for 30, and change history for the life of a watch.

curl -X POST https://netscrapehq.com/v1/watches/resync \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"label":"catalogue","changed_since":"2026-11-01T00:00:00Z"}'

Resync answers 202 with the number of watches it marked. Each gets one delivered read as soon as its min_interval and its site's budget allow, ending in watch.checked with a fresh result_url. Paused watches keep the request until they're resumed; retired watches are left out. Asking again while a resync is pending doesn't add another read.

For a single page whose latest body is still within seven days, GET /v1/watches/:id/current gives you its result_url without any read.

Job webhooks

One-off jobs use the same URL and signature. When a job you submitted finishes, Netscrape posts {"event": "job.succeeded", "job": {...}}, where job is what GET /v1/jobs/:id returns; results are never pushed. The event is job.succeeded, job.failed or job.cancelled, also in x-netscrape-event. Job webhooks are retried up to 12 times, and their x-netscrape-delivery is a delivery id, repeated on a retry.