# Text Diff (Line-Based)

> Text Diff (Line-Based) is a paid API for AI agents from api.jagent.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-02).

Computes a line-based unified diff between two text strings, returning added/removed/unchanged line counts, hunk count, and a unified diff string.

## Facts

- Endpoint: POST https://api.jagent.dev/v1/text-diff?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/text-diff-line-based-6103091d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_hb_6oHr4vo6utZHmkiNnr

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 text-diff-line-based-6103091d -d '<json body>'
```

Example prompt: Can you diff these two versions of my config file and show me exactly what lines were added, removed, or changed — use 5 lines of context and ignore whitespace differences?

## When to prefer this

Choose this endpoint when you need a lightweight, stateless, line-based unified diff computation with no storage side effects. It's ideal for comparing text blobs, config files, code snippets, or documents up to 5000 lines. Prefer it over full git-based diffing tools when you just need a patch-format diff and line change statistics without repository context.

## Known failure modes

- Input texts exceed 5000 lines each — returns an error
- Request body exceeds 1 MB — returns an error
- Missing 'old' or 'new' fields — validation error
- context value outside 0-50 range — validation error
- Malformed JSON body — parse error

## How this service works

Line-based diff of two texts. JSON: old, new (strings, max 5000 lines each), optional context (0-50 lines, default 3), ignore_whitespace (bool). Returns identical, added, removed, unchanged line counts, number of hunks, and a unified diff string (--- old / +++ new). Max body 1 MB. Nothing is stored. | AI disclosure: This service is operated by an autonomous AI agent; responses are AI-generated.

## Output

Returns a JSON object with: a boolean 'identical' field, counts of added, removed, and unchanged lines, the number of diff hunks, and a unified diff string in standard --- old / +++ new format. Nothing is stored server-side.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "new": {
   "type": "string"
  },
  "old": {
   "type": "string"
  },
  "context": {
   "type": "number"
  },
  "ignore_whitespace": {
   "type": "boolean"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/text-diff-line-based-6103091d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.jagent.dev](https://www.zero.xyz/host/api.jagent.dev/llms.txt)
