{"slug":"402utils-com-v1-diff-a3743d","title":"Compute the diff between two texts (a → b) — no git needed","host":"402utils.com","method":"POST","resource":"https://402utils.com/v1/diff","category":"code","description":"Compute the diff between two texts (a → b) — no git needed. Returns a standard unified patch (line-oriented in both modes, applies with git apply or patch), added/removed counts, and in word mode a token-level change list for inline highlighting (capped at 2000 entries). CRLF line endings and missin","price_listed":0.002,"price_asked":0.002,"state":"answering","state_label":"Answering","checks_7d":1,"answered_7d":1,"latency_ms_median":22,"reported_calls_30d":1,"reported_payers_30d":1,"networks":["eip155:8453"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"a":"name: farm\nprice: 1 USDC\n","b":"name: farm\nprice: 2 USDC\n"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"description":"Two texts to compare, byte-exactly (no line-ending normalization).","properties":{"a":{"description":"Original text. Max 1 MB UTF-8.","type":"string"},"b":{"description":"New text. Max 1 MB UTF-8.","type":"string"},"context":{"description":"Unchanged context lines around each patch hunk. Default 3.","maximum":10,"minimum":0,"type":"integer"},"mode":{"description":"Granularity of stats/changes. The patch is always a line-oriented unified diff. Default \"line\".","enum":["line","word"],"type":"string"}},"required":["a","b"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"description":"Unified patch plus change statistics.","properties":{"changes":{"description":"Word mode only (omitted when identical): token runs in order, capped at 2000 entries. Unchanged runs have added=removed=false.","items":{"properties":{"added":{"type":"boolean"},"removed":{"type":"boolean"},"value":{"description":"Text of the run.","type":"string"}},"required":["value","added","removed"],"type":"object"},"type":"array"},"identical":{"description":"True when a and b are identical; patch is then empty.","type":"boolean"},"mode":{"description":"Echo of the requested mode.","enum":["line","word"],"type":"string"},"patch":{"description":"Unified diff patch (--- a / +++ b headers). Line-oriented in both modes; empty when identical.","type":"string"},"stats":{"description":"Counts in lines (mode line) or words (mode word).","properties":{"added":{"description":"Lines/words added in b.","type":"integer"},"removed":{"description":"Lines/words removed from a.","type":"integer"}},"required":["added","removed"],"type":"object"},"truncated":{"description":"Word mode only: true when `changes` was capped at 2000 entries.","type":"boolean"}},"required":["identical","patch","stats","mode"],"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-09-24","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.002,"price_match":true,"latency_ms":22,"error":null}],"description_full":"Compute the diff between two texts (a → b) — no git needed. Returns a standard unified patch (line-oriented in both modes, applies with git apply or patch), added/removed counts, and in word mode a token-level change list for inline highlighting (capped at 2000 entries). CRLF line endings and missing trailing newlines are preserved byte-exactly. Caps: 1 MB UTF-8 per input; pathologically divergent inputs return 422 diff_too_complex.","last_updated":"2026-09-18T11:20:10.178Z","schemes":["exact"]}