Monitors
Automatic runs are not switched on yet. You can create, change and read monitors today, and a run happens when you call POST /v1/monitors/{id}/run (from your own scheduler, for example). The cadence field is stored now; the scheduled checks it sets are coming soon.
A monitor will check one page and tell you what changed since the last check. Use kind: "page" to compare the page text, or kind: "extract" to compare a list of records (products, listings, job posts) field by field.
| Endpoint | Description |
|---|---|
POST /v1/monitors | Create a monitor |
GET /v1/monitors | List monitors |
GET /v1/monitors/{id} | Read one monitor |
PATCH /v1/monitors/{id} | Change name, cadence, active, webhook or target |
DELETE /v1/monitors/{id} | Delete a monitor |
POST /v1/monitors/{id}/run | Run it now and get the diff |
GET /v1/monitors/{id}/runs | Run history |
GET /v1/monitors/{id}/runs/{runId} | One run with its full diff |
POST /v1/monitors/{id}/rotate-secret | New webhook signing secret |
Create a monitor
curl -X POST https://api.superscraper.dev/v1/monitors \
-H "x-api-key: YOUR_KEY" \
-H "content-type: application/json" \
-d '{
"name": "Competitor prices",
"kind": "extract",
"url": "https://shop.example.com/catalog",
"cadence": "daily",
"selectors": {
"item": "li.product",
"fields": {
"name": "h2",
"url": { "selector": "a", "attr": "href" },
"price": ".price"
}
},
"key": "url",
"webhook": "https://your-app.example.com/hooks/monitors"
}'| Field | Type | Description |
|---|---|---|
name | string | Required. 1 to 120 characters. |
url | string | Required. A public http(s) page. |
kind | page or extract | Default page. |
cadence | hourly, daily, weekly, monthly | Default daily. How often automatic checks will run once scheduled runs are switched on (coming soon). |
selectors | object | extract only. item is the CSS selector of each repeating element; fields maps a field name to a selector inside it (text), or to { "selector", "attr" } to read an attribute. Up to 20 fields. Without selectors, the record is the page's structured data. |
key | string | extract only. The field that identifies a record between runs. Without it, url is used, then the whole record. |
onlyMainContent | boolean | page only. Default true: navigation, headers and footers are left out of the comparison. |
webhook | string | A public http(s) URL that receives monitor.changed. |
active | boolean | Default true. |
The response holds the monitor and, when you set a webhook, webhook_secret. Store the secret: it is shown only here and when you rotate it.
What a run returns
The first run records a baseline and reports no change. Every later run compares with the previous successful run.
For an extract monitor the diff lists added and removed records and, under modified, each changed record with its fields:
{
"type": "records",
"baseline": false,
"changed": true,
"counts": { "added": 1, "removed": 0, "changed": 1, "unchanged": 48, "total": 50 },
"added": [{ "key": "url:/p/new-item", "record": { "name": "New item", "url": "/p/new-item", "price": "$19" } }],
"removed": [],
"modified": [{ "key": "url:/p/widget", "fields": [{ "field": "price", "before": "$10", "after": "$12" }] }],
"truncated": false
}For a page monitor the diff lists the lines that were added and removed. Whitespace changes are ignored.
{
"type": "page",
"changed": true,
"counts": { "added_lines": 1, "removed_lines": 1 },
"added_lines": ["Pro plan: $12 per month"],
"removed_lines": ["Pro plan: $10 per month"]
}Each list holds at most 100 entries (200 lines); counts are always exact and truncated tells you when a list was cut.
A run fails, costs nothing and keeps the previous baseline when the page cannot be fetched, when selectors match no items (usually a changed page layout), or when the page could not be read in full (run.reason is page_too_large: the download was over 20 MB, the HTML was over 2 MB after scripts and styles, it was nested too deep to parse, or its conversion ran out of time). A page that is only partly read is never compared with the baseline, so it cannot report a change that did not happen. run.status is completed, failed or skipped, and run.reason says why a run failed or was skipped.
Pricing
Each successful run costs 1 credit. A failed run costs nothing. When your balance cannot cover a run, POST /v1/monitors/{id}/run answers HTTP 402 insufficient_credits and nothing is charged.
Webhooks
When a run finds a change and the monitor has a webhook, SuperScraper sends a POST:
X-SuperScraper-Event: monitor.changed
X-SuperScraper-Timestamp: 1791000000
X-SuperScraper-Signature: sha256=5d41402abc4b2a76b9719d911017c592...{
"event": "monitor.changed",
"timestamp": 1791000000,
"data": {
"delivery_id": "mdl_6f1c...",
"monitor_id": "1b7e...",
"run_id": "6f1c...",
"name": "Competitor prices",
"kind": "extract",
"url": "https://shop.example.com/catalog",
"changed": true,
"diff": { "type": "records", "changed": true }
}
}Each monitor signs with its own secret. To verify a delivery:
- Compute HMAC-SHA256 with your
webhook_secretover{timestamp}.{raw body}, using theX-SuperScraper-Timestampheader and the body exactly as received. - Compare
sha256=<hex>withX-SuperScraper-Signatureusing a constant-time comparison. - Reject the delivery when the timestamp is more than 5 minutes from your clock.
- Reject a
delivery_idyou have already processed. A retry of the same delivery keeps its id.
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBody, headers, secret, seen) {
const ts = Number(headers['x-superscraper-timestamp']);
const expected = `sha256=${createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex')}`;
const given = String(headers['x-superscraper-signature'] ?? '');
if (expected.length !== given.length || !timingSafeEqual(Buffer.from(expected), Buffer.from(given))) return false;
if (Math.abs(Date.now() / 1000 - ts) > 300) return false;
const id = JSON.parse(rawBody).data?.delivery_id;
if (!id || seen.has(id)) return false;
seen.add(id);
return true;
}POST /v1/monitors/{id}/rotate-secret returns a new secret; the old one stops verifying at once. Webhook deliveries appear in the dashboard request log.
Teams and keys
An owner manages every monitor of the account. A team member sees and manages the monitors they created, and an API key a member created acts as that member. Another account's monitor answers HTTP 404.
A key restricted with scopes needs the monitor scope. See Privacy and key restrictions.
Zero data retention
A monitor stores each result so the next run can compare against it. With zero data retention on for the key or the account, creating, changing and running a monitor answer HTTP 400 zdr_unsupported. Reading and deleting monitors still work.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_url, blocked_url, invalid_selectors, invalid_key, invalid_cadence, invalid_webhook | The request is not valid |
| 400 | zdr_unsupported | Zero data retention is on |
| 402 | insufficient_credits | Not enough credits for a run |
| 404 | monitor_not_found | No such monitor for this account (or for this team member) |
| 409 | monitor_run_in_progress | A run of this monitor is in progress |
| 409 | monitor_limit_reached | The account holds the maximum number of monitors (50) |
| 503 | monitors_unavailable, webhook_signing_unavailable | Retry shortly |