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 key
120 requests / minute - Per IP
240 requests / minute - Max input
2 MB per side (text)
Errors
-
missing_api_keyHTTP 401 -
invalid_api_keyHTTP 401 -
rate_limitedHTTP 429 -
diff_failedHTTP 400 / 422 / 413 -
invalid_jsonHTTP 422
All errors use the shape { "ok": false, "error": { "code", "message" } }.