---
title: "MERCURY Cited Diff — signed web-change proof (refetch + verifiable fromHash->toHash receipt)"
method: GET
path: "/buy/diff"
tags: ["cited-diff", "web-change-proof", "change-detection", "verifiable-diff", "page-monitoring", "content-hash", "provenance", "attestation", "audit-trail", "verifiable-web-fetch", "agent-data", "keyless", "agent-native"]
---

# MERCURY Cited Diff — signed web-change proof (refetch + verifiable fromHash->toHash receipt)

`GET /buy/diff`

## Request

- Base URL: `https://network.mercury-hq.com`
- URL: `https://network.mercury-hq.com/buy/diff`
- Auth: none declared
- TypeScript: <https://skmtc.dev/mercury-hq/apis/mercury-x402-storefront/docs/buy/diff/get.ts> (a function with typed inputs; its response is checked against the schema)

URL + prior content-hash (or prior text) -> refetch, deterministic change-proof: changed? + a NEW signed receipt binding fromHash->toHash. Stateless; receipts chain into a tamper-evident audit trail of a page's evolution. Keyless x402, Base mainnet USDC.

## Query parameters

- `url` string, required: the page to re-fetch + diff (http/https)
- `prevHash` string: prior content hash (0x + 64 hex sha256) from an earlier MERCURY fetch/diff receipt. Gives a hash-only change-proof (changed? true/false). Use this OR prevText.
- `prevText` string: prior page text to diff against. Gives a full deterministic line-level diff (added/removed counts + unified-style hunk) on top of the change-proof. Use this OR prevHash.
- `format` 'text' | 'markdown': compare cleaned text (default) or structure-preserving markdown

## Response `200`

Delivered after the x402 payment settles on Base mainnet.

- object
  - `ok` boolean, required: true on success; false on an honest failure (still delivered)
  - `url` string, required: final URL after redirects
  - `status` integer: upstream HTTP status of the refetch
  - `changed` boolean: true if the new content hash differs from the prior reference
  - `fromHash` string: the prior content hash compared against (0x sha256). null if only prevText with no derivable hash
  - `toHash` string: the NEW content hash of the refetched text (0x sha256)
  - `comparedBy` 'hash' | 'text': hash = prevHash supplied; text = prevText supplied (full line diff)
  - `diff` object: deterministic line-level diff (present only when prevText was supplied)
    - `added` integer: number of added lines
    - `removed` integer: number of removed lines
    - `hunks` string[]: unified-style +/- changed lines (bounded)
    - `truncated` boolean: true if either side or the hunk list was capped
  - `text` string: the canonical CHANGE CLAIM string the attestation signs over (the proof, not the page body)
  - `bytes` integer: raw body size of the refetch
  - `contentType` string
  - `fetchedAt` string: ISO timestamp of the refetch (also in the signed receipt)
  - `error` string: present only when ok:false
  - `attestation` object: EIP-191 provenance receipt over the canonical change claim (url+changed+fromHash+toHash+time). ecrecoverable OFFLINE (key at /.well-known/mercury-attestation). Proves the change/no-change between hash A and hash B is genuine; chains with the next call's receipt into an audit trail.
    - `keyId` string
    - `alg` string
    - `address` string
    - `contentHash` string
    - `nonce` string
    - `signedAt` string
    - `signature` string
    - `verify` object
      - `message` string
      - `howTo` string

## Other responses

- `402`: Payment Required — retry with an x402-signed payment (e.g. x402-fetch). Terms are in the challenge body (x402 v1).

---

[API](https://skmtc.dev/mercury-hq/apis/mercury-x402-storefront.md) - [All operations](https://skmtc.dev/mercury-hq/apis/mercury-x402-storefront/llms.txt) - [OpenAPI document](https://skmtc.dev/mercury-hq/apis/mercury-x402-storefront/revisions/211aa7db24ae?raw)
