# Fresh402 Smart Diff

> Fresh402 Smart Diff is a paid API for AI agents from fresh402.kirilllabs.workers.dev, paid per call via x402, $0.015/call, status unknown (last checked 2026-10-11).

Performs a structural comparison of a watched URL's current content against a previous or baseline snapshot, returning a detailed diff with change significance scoring.

## Facts

- Endpoint: POST https://fresh402.kirilllabs.workers.dev/v2/smart-diff?utm_source=zero.xyz
- Price: $0.015/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fresh402-smart-diff-d88c11f7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_q8_1n7hBUmDpUKrYjpbwD

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 fresh402-smart-diff-d88c11f7 -d '<json body>'
```

Example prompt: Check watch ID w_0123456789abcdef0123456789abcdef and show me what structurally changed compared to the previous snapshot — especially any price or numeric field changes.

## When to prefer this

Use this endpoint when you need a structured, field-level diff of a watched URL's content changes — especially when you care about significance scoring, which fields changed, and before/after values. Prefer it over simple hash-check endpoints when you want actionable change details rather than just a boolean freshness flag. Best suited for monitoring JSON APIs, pricing pages, or structured HTML where path-level comparison adds value.

## Known failure modes

- Invalid or malformed watch_id (not matching ^w_[a-f0-9]{32}$ pattern) returns a validation error
- watch_id not found or not yet registered returns a 404-style error
- previous_hash provided does not match any stored snapshot, leading to comparison failure
- Payment not completed or x402 payment header missing results in 402 Payment Required
- Target URL is unreachable at diff time, causing a fetch error
- compare_to set to 'baseline' but no baseline was ever stored for the watch

## How this service works

Fresh402 2.0.0: durable payment results, private recovery, public web extraction, structural comparison and backward-compatible freshness. On-demand requests; no browser rendering or LLM inference.

## Output

Returns a JSON object containing the current and previous content hashes, counts of added/removed/modified fields, a detailed changes object listing each modified path with before/after values, a significance assessment (level, score, and reasons), the content kind (e.g. JSON or HTML), the comparison quality, and whether any changes were truncated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "watch_id": {
   "type": "string",
   "pattern": "^w_[a-f0-9]{32}$",
   "description": "Required ID returned by free fresh402_register or POST /v1/register. Example IDs are illustrative; replace them with a returned watch ID before paying."
  },
  "compare_to": {
   "enum": [
    "previous",
    "baseline"
   ],
   "type": "string",
   "default": "previous"
  },
  "previous_hash": {
   "type": "string",
   "pattern": "^[a-fA-F0-9]{64}$"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://example.com/",
  "hash": "1111111111111111111111111111111111111111111111111111111111111111",
  "counts": {
   "added": 0,
   "removed": 0,
   "modified": 1
  },
  "changed": true,
  "changes": {
   "added": [],
   "removed": [],
   "modified": [
    {
     "path": "/price",
     "after": 20,
     "before": 10
    }
   ]
  },
  "watch_id": "w_0123456789abcdef0123456789abcdef",
  "algorithm": "deterministic-v1",
  "final_url": "https://example.com/",
  "compare_to": "previous",
  "content_kind": "json",
  "significance": {
   "level": "medium",
   "score": 45,
   "reasons": [
    "content_changed",
    "numeric_or_price_change"
   ],
   "rules_version": 1
  },
  "previous_hash": "0000000000000000000000000000000000000000000000000000000000000000",
  "changes_truncated": false,
  "comparison_source": "smart_snapshot",
  "comparison_quality": "structural",
  "semantic_model_used": false
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fresh402-smart-diff-d88c11f7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from fresh402.kirilllabs.workers.dev](https://www.zero.xyz/host/fresh402.kirilllabs.workers.dev/llms.txt)
