Skip to main content

Quickstart: your first watch

Netscrape keeps your website data fresh: a watch re-reads a page on a schedule you choose and tells you when it really changes. This takes five steps: create a watch, ask for a check now, wait for it to finish, read the events it produced, and fetch the page Netscrape read. You need an API key from a paid Netscrape account. Sign up, verify your email, choose a plan and create a key on the API keys page. If self-serve signup is closed, request access and we will issue your key. To have a coding agent do these steps, use the agent prompts.

export NETSCRAPE_API_KEY="your key"

1. Create a watch

Watch a page and say how fresh it must stay. Here it's read at least once a day, and you may ask for a read at most once an hour.

curl https://netscrapehq.com/v1/watches \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"external_id":"catalogue-home","labels":["catalogue"],"request":{"url":"https://example.com/catalogue","render":"auto","output":"document","policy":{"robots":true}},"compare":{"on":"text"},"freshness":{"max_age":"1d","min_interval":"1h"}}'

Netscrape answers 201 with the watch. Keep its id:

{
  "id": "90a38653-a848-4a49-8634-055be25b3cde",
  "kind": "page",
  "external_id": "catalogue-home",
  "labels": ["catalogue"],
  "status": "active",
  "health": "pending",
  "schedule": "auto",
  "request": {
    "url": "https://example.com/catalogue",
    "render": "auto",
    "output": "document",
    "policy": {"robots": true}
  },
  "compare": {"on": "text"},
  "freshness": {"max_age": 86400, "min_interval": 3600, "adaptive": false},
  "interval": 86400,
  "lifecycle": {
    "gone_after": 2,
    "gone_spacing": 86400,
    "failing_after": 3,
    "failing_span": 86400,
    "blocked_after": 2,
    "on_gone": "keep_checking",
    "follow_moves": "same_site"
  },
  "next_check_at": "2026-11-14T08:37:27.659823Z",
  "last_check_at": null,
  "last_change_at": null,
  "current": {},
  "pending_job_id": null,
  "noisy": false,
  "deliver_next": false,
  "emit_checks": false
}

The first scheduled read is spread across the first interval, so it may be hours away. You don't have to wait for it.

2. Ask for a check now

export WATCH_ID=90a38653-a848-4a49-8634-055be25b3cde
curl -X POST https://netscrapehq.com/v1/watches/$WATCH_ID/check \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"deliver":true}'

deliver: true asks for a delivered check: it always ends in a watch.checked event that points at the page it read, even when nothing changed. The answer is 202 with the job that does the read:

{
  "id": "45ef34a0-9648-4240-b752-b89368298eaf",
  "type": "scrape",
  "status": "queued",
  "watch_id": "90a38653-a848-4a49-8634-055be25b3cde",
  "url": "https://example.com/catalogue",
  "status_url": "/v1/jobs/45ef34a0-9648-4240-b752-b89368298eaf",
  "result_url": null,
  "result_expires_at": "2026-11-20T11:10:15.664934Z"
}

The job response has more fields than shown here; the API reference lists them all. A watch has one check in flight at a time, so asking again before this one finishes returns 409 check_pending.

3. Wait for the check to finish

The check runs in the background, so its events arrive a few seconds or more after the 202. Events are numbered per account. Poll the feed for this watch's label until the watch.checked event for your check's job turns up, moving the cursor on each time. This loop uses jq:

export JOB_ID=45ef34a0-9648-4240-b752-b89368298eaf
CURSOR=0
until curl -fsS "https://netscrapehq.com/v1/events?after=$CURSOR&label=catalogue" \
    -H "Authorization: Bearer $NETSCRAPE_API_KEY" > events.json &&
  jq -e --arg job "$JOB_ID" \
    '.data[] | select(.type == "watch.checked" and .check.job_id == $job)' events.json > /dev/null
do
  NEXT=$(jq -r '.next_cursor // empty' events.json 2>/dev/null)
  CURSOR=${NEXT:-$CURSOR}
  sleep 5
done

In production, take webhooks instead of polling.

4. Read the events

Once it's done, read the feed from the start:

curl "https://netscrapehq.com/v1/events?after=0&label=catalogue" \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY"

The first successful read produces three events: the watch became healthy, its first version was recorded as a change, and the delivered check finished.

{
  "data": [
    {
      "id": "5a138101-2581-44bc-a90e-42ac638fa2b2",
      "sequence": 1,
      "type": "watch.health_changed",
      "at": "2026-11-13T11:10:15.689047Z",
      "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
      "from": "pending",
      "to": "healthy",
      "reason": "http_200",
      "evidence": {"kind": "healthy", "reason": "http_200", "status": 200, "challenge": null, "robots_rule": null},
      "check": {"id": "c14c8e51-de4d-464d-8e09-a044893b191a", "job_id": "45ef34a0-9648-4240-b752-b89368298eaf", "at": "2026-11-13T11:10:15.689047Z", "status": 200}
    },
    {
      "id": "914ec707-969a-4f74-a7a0-82b7f7afefdc",
      "sequence": 2,
      "type": "watch.changed",
      "at": "2026-11-13T11:10:15.689047Z",
      "watch": {"id": "90a38653-a848-4a49-8634-055be25b3cde", "external_id": "catalogue-home", "labels": ["catalogue"]},
      "before": {},
      "after": {
        "version": 1,
        "fingerprint": "ffadfb575da1f4732d52d5102d136dab523f095d98c0ba400e808c61ed8ffcfe",
        "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
      },
      "diff": {"kind": "lines", "added": 2, "removed": 0, "hunks": [{"op": "ins", "text": "Lamp A - 40\nLamp B - 55"}], "truncated": false},
      "reversal": false,
      "earlier_version": null,
      "check": {"id": "c14c8e51-de4d-464d-8e09-a044893b191a", "job_id": "45ef34a0-9648-4240-b752-b89368298eaf", "at": "2026-11-13T11:10:15.689047Z", "status": 200}
    },
    {
      "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"]},
      "delivered": true,
      "changed": true,
      "outcome": "changed",
      "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,
      "check": {"id": "c14c8e51-de4d-464d-8e09-a044893b191a", "job_id": "45ef34a0-9648-4240-b752-b89368298eaf", "at": "2026-11-13T11:10:15.689047Z", "status": 200}
    }
  ],
  "next_cursor": 3,
  "has_more": false,
  "webhook_status": "healthy"
}

Versions carry a few more hashes than shown; see Change events & webhooks. Store next_cursor once you've processed the page, and pass it as after next time.

5. Fetch the current page

curl https://netscrapehq.com/v1/watches/$WATCH_ID/current \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY"

This returns the latest version, with a result_url for the page Netscrape read. Download the page itself from that URL with the same key:

curl https://netscrapehq.com/v1/jobs/45ef34a0-9648-4240-b752-b89368298eaf/result \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY"

Page bodies are kept for seven days. After that, result_url is null and payload_expired is true; ask for a fresh read with a delivered check or a resync.

Next steps

curl -X DELETE https://netscrapehq.com/v1/watches/$WATCH_ID \
  -H "Authorization: Bearer $NETSCRAPE_API_KEY"