> /services/lurkd
lurkd
alphaHosted change watcher for bots: register an https URL at api.crocbot.net, poll JSON for its hash and last diff or get a signed webhook when it changes; every snapshot is ed25519-signed.
Details
lurkd is lurk's change detection as a hosted service run by crocbot.net: instead of keeping snapshots yourself, you register an https URL once and either poll a small JSON document that says whether it changed, how often, and what the last change looked like as a unified diff, or let lurkd push a signed webhook to you when it changes.
It is built for bots that cannot keep state between runs or do not want to fetch the same page every hour themselves. There are no accounts: one POST mints a bearer token, and each watch has an unguessable id you can read without it. Comparison works exactly like lurk: the raw bytes, the visible text, or only the main readable content of a page, with whitespace normalized and optional ignore patterns for noisy lines. Since 0.2.0 every snapshot lurkd takes is signed with its ed25519 key, so anyone can check what lurkd saw and when.
Since 0.3.0 you can also force a check now (POST /v1/watch/watches/{id}/check, Bearer, rate-limited, honors the host gap). Snapshot and watch JSON no longer carry a wildcard CORS header; curl and other non-browser clients are unaffected.
The API lives under https://api.crocbot.net/v1/watch (alpha: the interface may still gain fields, and the free tier is small). A human status page is at /v1/watch/status.
API reference
Base URL: https://api.crocbot.net/v1/watch. JSON in and out; every error is {"error": "<code>", "message": "<text>"}. Times are RFC 3339 UTC.
Quick start
B=https://api.crocbot.net/v1/watch
# a token (shown only once)
TOKEN=$(curl -s -X POST $B/tokens | jq -r .token)
# a watch with a push alert; the alert secret is shown only once
curl -s $B/watches -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"url": "https://example.com/pricing", "mode": "main-content", "alert_url": "https://bot.example.net/hooks/lurkd"}'
# poll it (no token needed: the random id is the capability)
curl -s $B/watches/$ID
# the latest signed snapshot
curl -s $B/watches/$ID/snapshot
# check it now (honors the host gap; 429 host_gap if too soon)
curl -s -X POST $B/watches/$ID/check -H "Authorization: Bearer $TOKEN"
# send a test event to the alert target now
curl -s -X POST $B/watches/$ID/alert/test -H "Authorization: Bearer $TOKEN"
curl -s -X POST $B/watches/$ID/renew -H "Authorization: Bearer $TOKEN"
curl -s -X DELETE $B/watches/$ID -H "Authorization: Bearer $TOKEN"
curl -s -X DELETE $B/tokens/self -H "Authorization: Bearer $TOKEN"
Without Authorization, POST /v1/watch/watches still mints a token and returns it once with the watch.
Endpoints
POST /v1/watch/tokens: mint a token,201 {token, token_note}(formatlkd_+ 64 hex digits). At most 10 per client address per 24 hours.DELETE /v1/watch/tokens/self: delete the calling token and all its watches,{"deleted": true, "watches": N}.POST /v1/watch/watches: create. Body{"url", "mode"?, "ignore_regex"?, "alert_url"?}. Optional Bearer token (without one, a new token is minted). Answers201with the watch and aLocationheader.GET /v1/watch/watches/{id}: read one watch. Public for anyone who knows the id (a random UUIDv4).GET /v1/watch/watches: the token's watches,{count, max, watches}. Needs the token.GET /v1/watch/watches/{id}/snapshot: the latest signed snapshot (below).404 no_snapshotbefore the first check that fetched the page.POST /v1/watch/watches/{id}/check: run a check now, honoring the same per-host gap as the scheduler. Bearer (owner). Answers the updated watch (and snapshot).429 host_gapwithretry_afterif that host was checked too recently.POST /v1/watch/watches/{id}/renew: extend the expiry to 30 days from now. Needs the owning token.DELETE /v1/watch/watches/{id}: delete,{"deleted": true, "id"}. Needs the owning token.PUT /v1/watch/watches/{id}/alert: set or replace the webhook target, body{"url": "https://..."}. Returns the newsecretonce (201new,200replaced; replacing rotates the secret). Needs the owning token.DELETE /v1/watch/watches/{id}/alert: remove the webhook target. Needs the owning token.POST /v1/watch/watches/{id}/alert/test: send onewatch.testevent now (one attempt) and return what was sent (sent.headers,sent.body) and the outcome. Needs the owning token.GET /v1/watch/pubkey: the snapshot signing key,{algorithm: "ed25519", key_id, public_key, public_key_pem, record_format};GET /v1/watch/pubkey.pemis the PEM alone.GET /v1/watch/health,GET /v1/watch/stats(aggregate counts, never URLs),GET /v1/watch/(index with limits),GET /v1/watch/status(human status page).
Responses no longer send Access-Control-Allow-Origin: *. Browser pages cannot read watch or snapshot JSON cross-origin; curl and other non-browser clients are unaffected.
Requests with a token count against 60 per token per minute.
Request fields
url(required): anhttps://URL on port 443, withoutuser:password@, at most 2048 ASCII characters (percent-encode, use punycode for international names).mode:raw(the bytes as fetched),text(visible text of HTML) ormain-content(the main readable content, as chomp extracts it). Defaultmain-content. Non-HTML text is compared as text, binary content by its bytes.ignore_regex: one pattern or a list of up to 5, at most 200 characters each, Rust regex syntax in multi-line mode (^and$match at line ends). Matches are removed before hashing, for example"^Updated \\d+ minutes ago$".alert_url: a webhook target, same rules asPUT .../alert. The response then carriesalert_secret, shown once. If the alert cannot be set (refused address, alert limit), no watch is created.
Unknown fields are rejected. The body must be Content-Type: application/json and at most 8 KiB.
The watch object
{"id": "0b6f…", "url": "https://example.com/pricing", "mode": "main-content", "ignore_regex": [],
"created_at": "2026-10-25T05:00:00Z", "expires_at": "2026-11-24T05:00:00Z",
"last_checked_at": "…", "next_check_at": "…", "last_changed_at": "…",
"content_sha256": "sha256:4f0c…", "changed_count": 1, "check_count": 2,
"last_status": 200, "last_error": null, "final_url": null,
"diff": "--- previous\n+++ current\n@@ -3 +3 @@\n-Pro: $20\n+Pro: $25\n",
"snapshot": {"fetched_at": "…", "status": 200, "content_sha256": "sha256:4f0c…",
"signature": "…", "key_id": "d99b34dd9c3409b3", "url": "https://api.crocbot.net/v1/watch/watches/0b6f…/snapshot"},
"alert": {"url": "https://bot.example.net/hooks/lurkd", "created_at": "…", "deliveries_ok": 1, "deliveries_failed": 0,
"last_delivery": {"event": "watch.changed", "delivery_id": "…", "at": "…", "ok": true, "http_status": 204, "attempts": 1, "error": null}},
"status_url": "https://api.crocbot.net/v1/watch/watches/0b6f…"}
- The first check runs right after creation and sets the baseline; it is not a change.
changed_countcounts checks whose hash differed from the one before.diffbelongs to the latest change and is capped at 60 lines and 8 KiB.last_statusis the HTTP status of the last check (304when a conditional request found nothing new).last_erroris set when the last check failed; the previous hash is kept.snapshotis the signed record of the last check that fetched the page;nulluntil there is one.alertisnullwithout a webhook target; its secret is never shown again.
Webhooks
When a check finds a change on a watch with an alert target, lurkd POSTs this to it:
POST /hooks/lurkd
Content-Type: application/json
User-Agent: lurkd/0.3.0 (+https://crocbot.net/services/lurkd/)
X-Lurkd-Event: watch.changed
X-Lurkd-Delivery: 5f2d… (the same on every retry of one event)
X-Lurkd-Timestamp: 1793178072 (Unix seconds of this attempt)
X-Lurkd-Signature: sha256=9b1e… (hex HMAC-SHA256)
{"event":"watch.changed","delivery_id":"5f2d…","watch_id":"0b6f…","url":"https://example.com/pricing",
"old_sha256":"sha256:4f0c…","new_sha256":"sha256:a917…","changed_at":"2026-10-28T09:01:12Z","changed_count":2,
"sent_at":"2026-10-28T09:01:12Z","snapshot":{…},"watch_url":"https://api.crocbot.net/v1/watch/watches/0b6f…"}
The diff is not in the event; fetch watch_url for it. watch.test events have the same shape with old_sha256 equal to new_sha256 and changed_at: null.
Verify every delivery: HMAC-SHA256 with the watch's secret over the X-Lurkd-Timestamp value, a dot, and the raw body bytes exactly as received; compare in constant time with the hex after sha256=, reject timestamps more than 5 minutes from your clock, and deduplicate on X-Lurkd-Delivery.
import hmac, hashlib, time
def verify(secret: str, headers, body: bytes) -> bool:
ts = headers["X-Lurkd-Timestamp"]
want = "sha256=" + hmac.new(secret.encode(), ts.encode() + b"." + body, hashlib.sha256).hexdigest()
return abs(time.time() - int(ts)) <= 300 and hmac.compare_digest(want, headers["X-Lurkd-Signature"])
- Targets follow the same address rules as watched URLs (below), checked when the target is set and again on every delivery.
- Redirects are not followed (a
3xxis a failure); any2xxis success. 5 s timeout per attempt; the response body is ignored. - Up to 3 attempts, retried after 10 s and 60 s on network errors, timeouts,
408,429and5xx; other4xxare final. Each attempt is signed with its own timestamp. - Retries are held in memory: a retry pending when lurkd restarts is dropped (the change is still in the watch's JSON).
Signed snapshots
Every check that fetched the page signs this record with lurkd's ed25519 key (UTF-8, a newline after every line):
lurkd-snapshot-v1
watch_id=0b6f2c8e-…
url=https://example.com/pricing
fetched_at=2026-10-28T09:01:12Z
content_sha256=sha256:a917…
status=200
The public key (key id d99b34dd9c3409b3; pin it rather than fetching it next to the snapshot you check):
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAvIKM9zvc+qCZmh22G35uBMKKkmrhbteJLKddWByGu/A=
-----END PUBLIC KEY-----
As raw base64 (32 bytes): vIKM9zvc+qCZmh22G35uBMKKkmrhbteJLKddWByGu/A=. The /snapshot response holds the fields, the exact signed_record, the base64 signature, key_id, public_key and the normalized text that content_sha256 hashes (when kept; binary or very large pages keep only the hash). Save the PEM above as lurkd.pem, rebuild the record from the fields rather than trusting signed_record, then check it (Signature Verified Successfully; the last line must print the hex of content_sha256):
curl -s $B/watches/$ID/snapshot > snap.json
jq -j '"lurkd-snapshot-v1\nwatch_id=\(.watch_id)\nurl=\(.url)\nfetched_at=\(.fetched_at)\ncontent_sha256=\(.content_sha256)\nstatus=\(.status)\n"' snap.json > record.txt
jq -r .signature snap.json | base64 -d > sig.bin
openssl pkeyutl -verify -pubin -inkey lurkd.pem -rawin -in record.txt -sigfile sig.bin
jq -j .text snap.json | sha256sum
A signature says lurkd fetched this URL at this time, got this status, and the normalized content hashed to this. It does not vouch for the content itself, and only the latest snapshot is kept.
Error codes
400invalid_json,invalid_url,invalid_mode,invalid_regex401missing_token,invalid_token;403forbidden(not your watch),watch_limitoralert_limit404not_found(unknown, expired or deleted),no_snapshot,no_alert;409duplicate(same url, mode and ignores on this token)413body_too_large;415unsupported_media_type422url_refused(scheme, port, credentials, private or reserved address, local name) ordns_failed429rate_limitedorhost_gapwithRetry-After;503capacitywithRetry-After
Free-tier limits
- 3 watches per token; 10 new watches and 10 new tokens per client address per 24 hours (IPv6 counted per /64); 500 active watches in total; 60 requests per token per minute.
- Checked about hourly (±10% jitter), at most one request per host at a time and 30 s apart, with conditional requests. One host can therefore be checked about 120 times an hour; if more watches point at the same host, their checks drift later than hourly (served in order, nothing skipped).
- Responses up to 2 MiB, 15 s timeout, up to 5 redirects (each hop is checked again).
- Webhooks: every watch of a token may have one; 60 deliveries per token per hour (a change over that is recorded as a failed delivery, not sent), of which at most 10 tests.
- Watches expire after 30 days unless renewed; expired watches are deleted.
Safety
lurkd only contacts public https:// addresses, for fetches and webhooks alike. Every address a host name resolves to must be public, when the watch or alert is set and on every fetch, redirect hop and delivery, so private, loopback, link-local, CGNAT, multicast and reserved IPv4 and IPv6 ranges are never contacted. Its User-Agent is lurkd/VERSION (+https://crocbot.net/services/lurkd/). Tokens are stored only as SHA-256 hashes; the signing key never leaves the server.