{"openapi":"3.1.0","info":{"title":"Text Diff API","version":"1.0.0","description":"Compare two pieces of text and get a precise, structured diff. Choose line, word or character granularity for a full edit script (equal, inserted, deleted) with addition and deletion counts, get a compact inline word diff, or render a standard unified diff (patch) with configurable context lines and file labels — ready to feed into patch tooling or a code-review UI. Built on a Longest-Common-Subsequence algorithm for accurate, minimal diffs. Every endpoint works by GET or JSON POST and runs entirely server-side with no third-party upstream, so responses are instant and the service is always available. Ideal for code review and version tooling, CMS and document editors, change tracking, plagiarism highlighting and content audits.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/textdiff-api","description":"oanor gateway"}],"tags":[{"name":"Diff"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/diff":{"get":{"operationId":"get_v1_diff","tags":["Diff"],"summary":"Structured diff (line/word/char)","description":"","parameters":[{"name":"a","in":"query","required":true,"description":"First text (old)","schema":{"type":"string"},"example":"hello world"},{"name":"b","in":"query","required":true,"description":"Second text (new)","schema":{"type":"string"},"example":"hello brave world"},{"name":"mode","in":"query","required":false,"description":"line | word | char (default line)","schema":{"type":"string"},"example":"word"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"mode":"word","stats":{"additions":2,"deletions":0,"unchanged":3,"total_changes":2},"changes":[{"op":"equal","value":"hello"},{"op":"equal","value":" "},{"op":"insert","value":"brave"},{"op":"insert","value":" "},{"op":"equal","value":"world"}],"identical":false},"meta":{"timestamp":"2026-05-30T18:17:09.679Z","request_id":"f073249f-83f6-4191-9755-70f5db177ad5"},"status":"ok","message":"OK","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/unified":{"get":{"operationId":"get_v1_unified","tags":["Diff"],"summary":"Unified diff (patch)","description":"","parameters":[{"name":"a","in":"query","required":true,"description":"First text (old)","schema":{"type":"string"},"example":"line one\\nline two\\nline three"},{"name":"b","in":"query","required":true,"description":"Second text (new)","schema":{"type":"string"},"example":"line one\\nline 2\\nline three"},{"name":"context","in":"query","required":false,"description":"Context lines (0-10, default 3)","schema":{"type":"string"},"example":"3"},{"name":"a_name","in":"query","required":false,"description":"Label for the old file","schema":{"type":"string"},"example":"old.txt"},{"name":"b_name","in":"query","required":false,"description":"Label for the new file","schema":{"type":"string"},"example":"new.txt"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"hunks":1,"patch":"--- old.txt\n+++ new.txt\n@@ -1,1 +1,1 @@\n-line one\\nline two\\nline three\n+line one\\nline 2\\nline three\n","identical":false},"meta":{"timestamp":"2026-05-30T18:17:09.756Z","request_id":"21f138bb-4932-4a59-8e35-703a90e66677"},"status":"ok","message":"OK","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/words":{"get":{"operationId":"get_v1_words","tags":["Diff"],"summary":"Inline word diff","description":"","parameters":[{"name":"a","in":"query","required":true,"description":"First text","schema":{"type":"string"},"example":"the quick brown fox"},{"name":"b","in":"query","required":true,"description":"Second text","schema":{"type":"string"},"example":"the slow brown fox"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"stats":{"words_added":1,"words_removed":1},"segments":[{"op":"equal","value":"the "},{"op":"delete","value":"quick"},{"op":"insert","value":"slow"},{"op":"equal","value":" brown fox"}],"identical":false},"meta":{"timestamp":"2026-05-30T18:17:09.831Z","request_id":"2ffe312f-c2c6-4592-a674-25e706640eca"},"status":"ok","message":"OK","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":500,"rps_limit":1,"hard_limit":true},{"slug":"basic","name":"Basic","price_cents_month":200,"monthly_call_quota":20000,"rps_limit":5,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":600,"monthly_call_quota":150000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":1500,"monthly_call_quota":1000000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/textdiff-api"}