# Watch & Diff

> Watch & Diff is a paid API for AI agents from watch-diff.agent-utils.workers.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Fetches two versions of a URL's content, normalizes and hashes them, then returns a structured diff showing exactly what changed between the before and after snapshots.

## Facts

- Endpoint: POST https://watch-diff.agent-utils.workers.dev/v1/diff
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/watch-diff-754fd805
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_v9iaTeRl-p0eXBowzCGLI

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability watch-diff-754fd805 -d '<json body>'
```

Example prompt: Check if this product page changed since my last snapshot — here's the before text and the after text, and tell me exactly which lines were added or removed and what the similarity score is.

## When to prefer this

Choose this endpoint when you need a structured, line-level diff with similarity scoring for recurring agent tasks — especially when you already have both the before and after content strings and want a normalized comparison that ignores whitespace noise. It is ideal for AI agents running scheduled monitoring loops that need to detect meaningful changes without storing state themselves. Prefer it over generic scraping tools when you need the diff result as structured data (added/removed arrays) rather than raw HTML.

## Known failure modes

- Input 'before' or 'after' content exceeds 500,000 character limit — request rejected
- Missing required 'before' or 'after' query parameters — schema validation error
- Payment not provided or insufficient USDC balance via x402 — 402 Payment Required response
- Content is binary or undecodable — normalization may fail or return empty diff
- Extremely large payloads may result in truncated diff output (truncated: true)

## How this service works

Did this URL change since my last check? Fetch, normalize, hash and diff any page, region or JSON for AI agents running recurring tasks. State per paying wallet, 90 days. Pay per call over x402, no API key.

## Output

Returns a JSON object with a 'changed' boolean, a 'similarity' score from 0 to 1, and a 'diff' object containing arrays of added and removed lines, integer counts of added and removed lines, and a 'truncated' flag if the diff was too large to return in full.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "before",
      "after"
     ],
     "properties": {
      "after": {
       "type": "string",
       "maxLength": 500000
      },
      "before": {
       "type": "string",
       "maxLength": 500000
      },
      "ignoreWhitespace": {
       "type": "boolean",
       "default": true
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "diff": {
       "type": "object",
       "properties": {
        "added": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "removed": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "truncated": {
         "type": "boolean"
        },
        "addedLines": {
         "type": "integer"
        },
        "removedLines": {
         "type": "integer"
        }
       }
      },
      "changed": {
       "type": "boolean"
      },
      "similarity": {
       "type": "number",
       "description": "0..1 share of unchanged lines"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "diff": {
   "added": [
    "price: 12"
   ],
   "removed": [
    "price: 10"
   ],
   "truncated": false,
   "addedLines": 1,
   "removedLines": 1
  },
  "changed": true,
  "similarity": 0.5
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/watch-diff-754fd805/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from watch-diff.agent-utils.workers.dev](https://www.zero.xyz/host/watch-diff.agent-utils.workers.dev/llms.txt)
