REST API v1

Programmatic access to every diff engine. Base URL https://diffbolt.com/api/v1

Authentication

Every request needs a key — create one on your account page.

curl -X POST https://diffbolt.com/api/v1/diff/text \
  -H "X-API-Key: dk_…" \
  -H "Content-Type: application/json" \
  -d '{"left":"hello world","right":"hello PHP"}'
X-API-Key: dk_…

API keys are managed on the account page. Never expose keys in client-side code.

Authorization: Bearer dk_…

Equivalent alternative.

Endpoints

POST /api/v1/diff/text Compare two texts

Body:

left , right , options…

options: engine (auto|myers|patience|gnu), ignoreCase, ignoreWhitespace (none|trim|collapse|all), wordLevel, context

POST /api/v1/diff/json Structural JSON diff

Body:

left , right

Returns the tree change list plus the canonical text diff.

POST /api/v1/diff/structured/xml Structural XML diff

Body:

left , right
POST /api/v1/diff/structured/csv Row-aware CSV diff

Body:

left , right
POST /api/v1/diff/files Compare two uploaded files

Body (multipart/form-data):

multipart: left, right
POST /api/v1/diff/url Fetch and compare two URLs

Body:

left , right
POST /api/v1/diff/image Pixel-compare two images (base64 body or multipart)

Body:

left , right

Returns metrics + PNG data URIs (diff overlay, resized originals).

POST /api/v1/diffs Save a diff and get a share link

Body:

type , left , right , title? , expiresIn? , password?
GET /api/v1/diffs/:code Fetch a saved diff
GET /api/v1/health Service + storage health

Rate limits

  • Per key120 requests / minute
  • Per IP240 requests / minute
  • Max input2 MB per side (text)

Errors

  • missing_api_key HTTP 401
  • invalid_api_key HTTP 401
  • rate_limited HTTP 429
  • diff_failed HTTP 400 / 422 / 413
  • invalid_json HTTP 422

All errors use the shape { "ok": false, "error": { "code", "message" } }.