/api/v1/diffDiff markdown API
Line-oriented added / removed / unchanged.
POST /api/v1/diff returns a line-oriented diff between two markdown documents tagged added / removed / unchanged. Perfect for editorial review UIs and AI editing pipelines.
Overview
Line-by-line diff between two markdown documents. Each entry is tagged `added`, `removed`, or `unchanged` — ready for inline review UIs, content-review tools, and AI editing feedback loops.
Request
Authenticate with Authorization: Bearer YOUR_API_KEY and send a JSON body containing the parameters below. Pick your language:
curl -X POST 'https://trymarkdownviewer.com/api/v1/diff' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"left":"Hello world\n","right":"Hello there\n"}'Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
| left | string | required | Original markdown. |
| right | string | required | Updated markdown. |
Response
Success responses are wrapped in a data field. Errors use { error: { code, message } } with an appropriate HTTP status — see the error reference.
{
"data": {
"diff": [
{
"type": "removed",
"value": "Hello world"
},
{
"type": "added",
"value": "Hello there"
}
],
"added": 1,
"removed": 1,
"unchanged": 0
}
}Use cases
Editorial review
Render a side-by-side review UI for content changes.
AI editing
Inspect exactly what an LLM changed in a document.
Related endpoints
Try in browser
Free tools that run the same logic locally — no API key, no upload.
Try it
Send a real request against your account in the API playground. Errors there link straight back to the error reference.