{"uid":"cap_RVEv92qA2e5hJb9ZNPJ9U","slug":"sitecheck-text-diff-8d81e281","name":"SiteCheck Text Diff","description":"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).","url":"https://api.sitecheck-api.workers.dev/api/text/diff?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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"}}},"responseSchema":{"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}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_EUiveI1-_7TFj7SkZ6esG","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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.'","exampleUseCases":[{"title":"Document revision change summary","prompt":"I have two versions of a contract clause — can you do a line-by-line diff and tell me exactly what was added or removed? Original: 'Payment is due within 30 days of invoice.' Revised: 'Payment is due within 14 days of invoice, with a 2% late fee.'"},{"title":"Code config file comparison","prompt":"Compare these two YAML config snippets character by character and give me the similarity score and unified diff so I can see what changed between the old and new deployment config."},{"title":"Plagiarism similarity check","prompt":"I want to know how similar these two student essay paragraphs are — run a word-level diff and tell me the similarity percentage and which words were added or removed."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T07:05:17.351Z","isFirstParty":false,"canonicalSlug":"sitecheck-text-diff-8d81e281"}