Catalog/text-diff

Text

Diff two texts API

Compute a line-by-line diff between two texts (added/removed/unchanged) with summary stats. Answers 'diff these two texts', 'what changed between these versions', 'compare these strings'.

Price$0.01per request
MethodPOST
Route/v1/text/diff
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
textdiffcomparechangespatchversions
API URLhttps://x402.hexl.dev/v1/text/diff
Integration docs
Example request
{
  "a": "line1\nline2",
  "b": "line1\nline2 changed"
}
Example response
{
  "changes": [
    {
      "type": "equal",
      "value": "line1"
    },
    {
      "type": "remove",
      "value": "line2"
    },
    {
      "type": "add",
      "value": "line2 changed"
    }
  ],
  "stats": {
    "added": 1,
    "removed": 1,
    "unchanged": 1
  },
  "truncated": false
}
Input schema
{
  "type": "object",
  "required": [
    "a",
    "b"
  ],
  "properties": {
    "a": {
      "type": "string"
    },
    "b": {
      "type": "string"
    }
  }
}
Output schema
{
  "type": "object",
  "required": [
    "changes",
    "stats"
  ],
  "properties": {
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "stats": {
      "type": "object",
      "additionalProperties": true
    },
    "truncated": {
      "type": "boolean"
    }
  }
}