{"uid":"cap_OL9Yy07fTNUL-jMXCBvAj","slug":"text-diff-word-line-39068653","name":"Text Diff (Word/Line)","description":"Diff of two short texts into equal, deleted and inserted lines or words, with counts and a similarity ratio.","url":"https://text-similarity.x402tookit.com/text-diff?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":["GET"],"type":"string"},"queryParams":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","description":"Original text, up to 2000 characters"},"b":{"type":"string","description":"New text, up to 2000 characters"},"unit":{"enum":["word","line"],"type":"string","description":"word (default) or line"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"unit":{"type":["null","string"]},"added":{"type":["null","number"]},"edits":{"type":["array","null"],"items":{"type":"object","properties":{"op":{"type":["null","string"]},"text":{"type":["null","string"]},"count":{"type":["null","number"]}}}},"ratio":{"type":["null","number"]},"source":{"type":["null","string"]},"unitsA":{"type":["null","number"]},"unitsB":{"type":["null","number"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"removed":{"type":["null","number"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"unchanged":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_a5Fqtxl1_KN2mN4vdzZYb","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes a diff of two short texts into equal, inserted, and deleted segments at word or line granularity, returning counts and a similarity ratio.","exampleAgentPrompt":"Compare these two paragraphs word by word and tell me what was added, removed, and unchanged, plus how similar they are: original is 'The quick brown fox jumps over the lazy dog' and the new version is 'The quick red fox leaps over a sleepy dog'.","exampleUseCases":[{"title":"Detect edits in revised draft","prompt":"I have an original paragraph and a revised version — can you diff them word by word and show me exactly what was added, deleted, and kept the same, along with a similarity score? Original: 'Our product ships in 3 to 5 business days.' Revised: 'Our product ships in 1 to 2 business days via express delivery.'"},{"title":"Line-by-line changelog review","prompt":"Compare these two config file snippets line by line and tell me which lines were added, removed, or unchanged: original is 'timeout=30\nretries=3\nverbose=false' and the new version is 'timeout=60\nretries=5\nverbose=true\nlog_level=debug'."},{"title":"Check how much a translation drifted","prompt":"I paraphrased a sentence and want to know how different it is from the original — diff these two word by word and give me the similarity ratio: 'Customers must register before placing an order.' vs 'Users are required to sign up prior to submitting a purchase.'"}],"resultDescription":"Returns a structured diff with an array of edit operations (each tagged as equal, insert, or delete with the affected text and token count), total added/removed/unchanged unit counts, word or character counts for each input text, an overall similarity ratio between 0 and 1, a human-readable summary and verdict, and metadata like the diff unit and timestamp.","failureModes":["Missing required parameters 'a' or 'b' returns an error","Input text exceeding 2000 characters per field may be rejected or truncated","Invalid 'unit' enum value (not 'word' or 'line') returns a validation error","Empty strings for both inputs may return a trivial result with ratio 1.0 or 0.0","Payment failure (x402) results in 402 response and no diff is returned"],"whenToPreferThis":"Choose this endpoint when you need a structured, token-level breakdown of differences between two short texts — not just a similarity score but the actual edit operations (what was added, deleted, kept). It is ideal when you need both the diff sequence and a similarity ratio in a single call. Prefer it over pure similarity endpoints (Levenshtein, cosine, Jaro-Winkler) when the agent needs to explain or display what changed, not just how different the texts are. Best for texts up to 2000 characters each.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:19:34.290Z","isFirstParty":false,"canonicalSlug":"text-diff-word-line-39068653"}