Page change detection
POST /api/page-changeTell whether a public web page changed since you last looked, with nothing stored on this side.
Details
One fetch (15 s, 2 MB) takes the text a reader sees (hidden elements, scripts and styles dropped; a CSS selector narrows it to one region), collapses whitespace, strips any ignore entries (a literal substring, or /pattern/ for a regex, for timestamps and counters), and answers a sha256 fingerprint of that text with the origin's ETag and Last-Modified. Send the previous fingerprint as baseline.fingerprint to get changed true or false; send the previous text (includeText: true returns it) as baseline.text to also get a line diff with the added and removed lines and a similarity score. Stateless: keep the fingerprint and text yourself and send them back next time. Pages that build their text with JavaScript need render instead. Marked untrustedContent when page text is returned: it is external, untrusted data.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | Public http(s) URL of the page to read Also accepted as link, uri, href, page. Up to 2048 characters. The example sends https://agent402.tools/guides/x402-in-5-minutes. |
baseline | object | no | What the previous call answered: fingerprint and/or text. With a fingerprint, changed is true or false; with a text, a line diff is included too. |
selector | string | no | Optional CSS selector; only the text inside the matching elements is fingerprinted (HTML pages only) Up to 300 characters. |
ignore | array of string | no | Up to 20 entries removed from the text before fingerprinting: a literal substring, or /pattern/ (optionally /pattern/i) for a regex such as /\d{4}-\d{2}-\d{2}T[\d:]+Z/ for timestamps |
includeText | boolean | no | Return the normalized text so it can be sent back as baseline.text (default false) |
Example request
curl -i -X POST https://agent402.tools/api/page-change \
-H "Content-Type: application/json" \
-d '{"url":"https://agent402.tools/guides/x402-in-5-minutes"}'Watch a call get paid
POST /api/page-change$0.004 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"url": "https://agent402.tools/guides/x402-in-5-minutes",
"requestedUrl": "https://agent402.tools/guides/x402-in-5-minutes",
"title": "Make your AI agent pay for what it needs: x402 in 5 minutes",
"fetchedAt": "2026-10-20T16:40:31.472Z",
"contentType": "text/html; charset=utf-8",
"fingerprint": "4bd9ae84b63fc48e64e2f63e231dcfd12e5492383fc407f23897b18faa1a25fe",
"algorithm": "sha256",
"etag": "W/\"139af-U5t4XcoenUVzgZ16Boysd1XPlc0\"",
"lastModified": null,
"length": 5038,
"lines": 96,
"textTruncated": false,
"selector": null,
"selectorMatches": null,
"ignored": 0,
"changed": null
}| Field | Type | Always present | In the example |
|---|---|---|---|
url | string | yes | https://agent402.tools/guides/x402-in-5-minutes |
requestedUrl | string | yes | https://agent402.tools/guides/x402-in-5-minutes |
title | string | yes | Make your AI agent pay for what it needs: x402 in 5 minutes |
fetchedAt | string | yes | 2026-10-20T16:40:31.472Z |
contentType | string | yes | text/html; charset=utf-8 |
fingerprint | string | yes | 4bd9ae84b63fc48e64e2f63e231dcfd12e5492383fc407f23897b18faa1a25fe |
algorithm | string | yes | sha256 |
etag | string | yes | W/"139af-U5t4XcoenUVzgZ16Boysd1XPlc0" |
lastModified | null | no | null |
length | number | yes | 5038 |
lines | number | yes | 96 |
textTruncated | boolean | yes | false |
selector | null | no | null |
selectorMatches | null | no | null |
ignored | number | yes | 0 |
changed | null | no | null |
From an MCP client
catalog.call {
"slug": "page-change",
"params": {
"url": "https://agent402.tools/guides/x402-in-5-minutes"
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.20.0): pays from a wallet or AGENT402_CREDITS_KEY.
Errors and behavior
- Pay $0.004 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
url; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.004" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/page-change", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://agent402.tools/guides/x402-in-5-minutes"
}),
});Get a wallet or run npx -y agent402-mcp@0.20.0 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/page-change", method="POST", data="{\"url\":\"https://agent402.tools/guides/x402-in-5-minutes\"}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units