Skip to content
POST AI agent ready /v1/diff

Text Diff API - Free Line-by-Line Comparison

Submit two text strings and receive a line-by-line diff showing additions, deletions, and unchanged lines. The output follows the unified diff format.

Parameters

stringrequired

The original text.

stringrequired

The modified text.

Code examples

curl -X POST https://api.botoi.com/v1/diff \
  -H "Content-Type: application/json" \
  -d '{"original":"line 1\nline 2\nline 3","modified":"line 1\nline 2 updated\nline 3\nline 4"}'

When to use this API

Content version comparison

Compare two versions of a blog post or document to highlight edits before publishing, like a simplified track-changes view.

Configuration drift detection

Compare the expected and actual configuration files in your deployment to detect unauthorized or accidental changes.

Frequently asked questions

What diff algorithm is used?
The API uses the Myers diff algorithm, the same algorithm used by git diff.
Is the comparison case-sensitive?
Yes. "Line 1" and "line 1" are treated as different. Normalize case before sending if you want case-insensitive comparison.
What is the maximum text size?
Each text field can be up to 500 KB. For larger files, split them into smaller sections.
Can I get a unified diff patch format?
The response uses a structured JSON format with change types. For raw unified diff output, combine the changes client-side.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.