# SiteCheck Text Diff

> SiteCheck Text Diff is a paid API for AI agents from api.sitecheck-api.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-30).

Computes a structured diff between two text strings, returning added/removed/unchanged parts, similarity score, and unified diff output at line, word, or character granularity.

## Facts

- Endpoint: POST https://api.sitecheck-api.workers.dev/api/text/diff?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/sitecheck-text-diff-8d81e281
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_RVEv92qA2e5hJb9ZNPJ9U

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 sitecheck-text-diff-8d81e281 -d '<json body>'
```

Example prompt: Compare these two paragraphs word by word and tell me what changed, how similar they are, and show me the unified diff — here's the original: 'The quick brown fox jumps over the lazy dog.' and the revised version: 'The quick red fox leaped over the sleepy dog.'

## When to prefer this

Choose this endpoint when you need a structured, machine-readable diff with similarity scoring and unified diff output in a single pay-per-call API, without managing a diff library or runtime. Ideal for agents that need to compare text programmatically and consume the result (e.g. summarize changes, detect plagiarism, audit revisions) rather than just display a diff to a human. Prefer it over local diff libraries when operating in a serverless or sandboxed agent environment.

## Known failure modes

- Missing 'a' or 'b' fields returns a 400 error
- Invalid 'mode' value (not 'lines', 'words', or 'chars') may default to lines or return an error
- Extremely large texts may result in truncated parts (partsTruncated: true)
- Payment failure (x402 protocol) prevents the call from being processed
- Network timeout on the Cloudflare Workers edge

## How this service works

Differences between two texts: mode lines, words or chars; the added, removed and unchanged parts with counts, a similarity ratio (2 x unchanged / both texts' units), and a unified diff for lines. Body { a, b, mode }: lines and words up to 50 KB each, chars up to 20 KB each (capped for the Worker's CPU budget). Pure code using the diff package (BSD-3-Clause).

## Output

Returns a JSON object with: an array of diff parts each labeled as 'added', 'removed', or 'unchanged' with their text and count; aggregate counts of added/removed/unchanged units; a similarity score (0–1); an 'identical' boolean; a unified diff string in standard patch format; the diff mode used; a timestamp; and a flag indicating whether parts were truncated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "a": {
   "type": "string",
   "description": "The first text (JSON body field)"
  },
  "b": {
   "type": "string",
   "description": "The second text (JSON body field)"
  },
  "mode": {
   "type": "string",
   "description": "lines (default), words or chars"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mode": "lines",
  "parts": [
   {
    "type": "unchanged",
    "count": 1,
    "value": "one\n"
   },
   {
    "type": "removed",
    "count": 1,
    "value": "two\n"
   },
   {
    "type": "added",
    "count": 1,
    "value": "2\n"
   }
  ],
  "counts": {
   "added": 1,
   "aUnits": 3,
   "bUnits": 3,
   "removed": 1,
   "unchanged": 2
  },
  "source": "Computed here with the diff package (Myers algorithm); similarity = 2 x unchanged / (both texts' units)",
  "checkedAt": "2026-10-15T13:48:02.047Z",
  "identical": false,
  "similarity": 0.6667,
  "unifiedDiff": "===================================================================\n--- a\t\n+++ b\t\n@@ -1,3 +1,3 @@\n one\n-two\n+2\n three\n\\ No newline at end of file\n",
  "partsTruncated": false
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/sitecheck-text-diff-8d81e281/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.sitecheck-api.workers.dev](https://www.zero.xyz/host/api.sitecheck-api.workers.dev/llms.txt)
