{"uid":"cap_Z7jRfWLv78evvd4Adhpeb","slug":"text-diff-word-level-change-analysis-f7d85e1f","name":"Text Diff — Word-Level Change Analysis","description":"Word-level diff of two texts: words added, removed and kept, the changed spans, and a percent changed.","url":"https://text-metrics.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":["old","new"],"properties":{"new":{"type":"string","description":"New text"},"old":{"type":"string","description":"Original text (up to 1500 characters)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"kept":{"type":["null","number"]},"added":{"type":["null","number"]},"source":{"type":["null","string"]},"changes":{"type":["array","null"],"items":{"type":"object","properties":{"added":{"type":["null","string"]},"removed":{"type":["null","string"]}}}},"reasons":{"type":["array","null"],"items":{"type":"string"}},"removed":{"type":["null","number"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"wordsNew":{"type":["null","number"]},"wordsOld":{"type":["null","number"]},"changedPct":{"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_QJ0aHsi8NuxznYZfJQPk8","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 word-level diff of two texts, returning counts of added, removed, and kept words, changed spans, and a percentage-changed score.","exampleAgentPrompt":"Compare these two paragraphs word by word and tell me what was added, removed, and kept, and what percentage changed — original: 'The quick brown fox jumps over the lazy dog', new: 'The quick red fox leaps over the sleeping cat'.","exampleUseCases":[{"title":"Track edits in a contract revision","prompt":"I need to see exactly what words changed between the first draft and revised draft of this contract clause — original: 'The payment shall be due within 30 days of invoice receipt', new: 'The payment shall be due within 14 days of invoice receipt and must be confirmed in writing'. Show me what was added, removed, and what percentage changed."},{"title":"Content moderation version audit","prompt":"My CMS just saved a new version of this article intro. Can you diff the old and new text word by word and tell me how much was changed? Old: 'Our store offers free shipping on orders over $50.' New: 'Our store now offers free express shipping on all orders over $75 for members.'"},{"title":"Detect plagiarism edits in student submissions","prompt":"A student submitted two drafts and I want to see if they only made minor word swaps. Compare these two texts word by word and give me the percentage changed along with the exact spans that differ — old text is 'Climate change threatens biodiversity and human populations worldwide', new text is 'Climate change endangers biodiversity and communities globally'."}],"resultDescription":"Returns counts of added, removed, and kept words; an array of changed spans each with the added and removed text; total word counts for both texts; and a changedPct value representing the proportion of the text that was modified.","failureModes":["Missing 'old' or 'new' query parameter returns an error","Input text exceeding 1500 characters for the old text may be rejected or truncated","Empty strings may return zero changes with 0% changed","Non-text or binary content passed as strings may produce unexpected token counts"],"whenToPreferThis":"Choose this endpoint when you need a structured, machine-readable word-level diff with explicit counts and changed spans — not just a similarity score. It is ideal when you need to know exactly which words were added or removed and by how much the text changed, rather than just whether two texts are similar (use the similarity endpoint for that). Best for revision tracking, audit trails, and change detection workflows.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:37:54.751Z","isFirstParty":false,"canonicalSlug":"text-diff-word-level-change-analysis-f7d85e1f"}