Bearer key · JSON
POST /api/v1/diff
curl -s -X POST https://getattest.com.au/api/v1/diff \
-H "authorization: Bearer $ATTEST_API_KEY" \
-H "content-type: application/json" \
-d '{"a":"alpha\nbeta\ngamma\n","b":"alpha\nbeta two\ngamma\n","mode":"lines"}'
Send the key as a bearer token in the authorization header. One key and one credit balance cover every service, including Attest Capture. A failed call is refunded automatically. No key yet? POST /api/v1/keys issues one with 25 free credits and no signup — see the key guide.
Captured 2026-09-21
Example
This request was run against the running service on 2026-09-21 and the response below is what came back, unedited.
Request JSON
{
"a": "alpha\nbeta\ngamma\n",
"b": "alpha\nbeta two\ngamma\n",
"mode": "lines"
}
Captured response JSON
{
"call_id": "6f854f6d-0473-48b9-9615-dd128a0d8455",
"mode": "lines",
"unit": "lines",
"identical": false,
"stats": {
"added": 1,
"removed": 1,
"unchanged": 2
},
"changes": [
{
"type": "unchanged",
"value": "alpha\n"
},
{
"type": "removed",
"value": "beta\n"
},
{
"type": "added",
"value": "beta two\n"
},
{
"type": "unchanged",
"value": "gamma\n"
}
],
"truncated": false,
"coarse": false,
"unified_patch": "--- a\n+++ b\n@@ -1,3 +1,3 @@\n alpha\n-beta\n+beta two\n gamma\n",
"patch_truncated": false,
"options": {
"ignore_whitespace": false,
"ignore_case": false,
"context_lines": 3
},
"checked_at": "2026-09-20T16:55:57.233Z",
"credits_charged": 1,
"credits_remaining": 9993
}
For agents
Use when
Use this when a task needs to know exactly what changed between two versions of a text, document, config file or JSON payload: line, word or character changes with a unified patch, or a JSON Pointer list of structural changes. Inputs are capped at 1,000,000 characters a side and 1,500,000 combined; lines and words mode handle that whole range, while chars mode on a heavily rewritten document falls back to block-level changes (coarse: true in the response) rather than taking longer.
6 fields
Input
Scroll the table horizontally to see all fields.
Field / Type / Required / What it does| Field | Type | Required | What it does |
|---|
a | string | Required | The first version. Up to 1,000,000 characters. |
|---|
b | string | Required | The second version. a and b together are capped at 1,500,000 characters. |
|---|
mode | string | Optional | lines (default), words, chars or json. |
|---|
ignore_whitespace | boolean | Optional | Treat runs of whitespace as equal. |
|---|
ignore_case | boolean | Optional | Compare without case. |
|---|
context_lines | integer | Optional | Lines of context in the unified patch, 0-20. |
|---|
HTTP 200
Response
Every successful response also carries call_id (your receipt for the charge), credits_charged and credits_remaining.
Scroll the table horizontally to see all fields.
Field / What it holds| Field | What it holds |
|---|
mode | The mode that ran. |
|---|
unit | What a change is counted in: lines, words, characters or JSON pointers. |
|---|
identical | Whether the two sides are the same. |
|---|
stats | Added, removed and, for json, changed counts. |
|---|
changes | Each change, with its position. |
|---|
unified_patch | A unified diff, for the text modes. |
|---|
coarse | True when chars mode fell back to block-level changes rather than taking longer. |
|---|
truncated | Whether the change list stopped at a cap. |
|---|
options | The options that were applied. |
|---|
Machine-readable failures
Errors
Errors return JSON such as {"error":"invalid_api_key"}. A failed call is refunded automatically.
Scroll the table horizontally to see all fields.
Code / Status / Meaning| Code | Status | Meaning |
|---|
a_required | 400 | No a was sent. |
|---|
b_required | 400 | No b was sent. |
|---|
input_too_long | 400 | a and b together are past the combined cap; the response carries the limit. |
|---|
too_many_lines | 400 | The two sides have more lines together than the cap. |
|---|
invalid_json_a | 400 | mode json was used and a is not valid JSON. |
|---|
invalid_json_b | 400 | mode json was used and b is not valid JSON. |
|---|
json_too_deep | 400 | A JSON document nests deeper than the cap. |
|---|
diff_too_complex | 502 | The comparison did not finish inside the budget. Not charged. |
|---|
On every service
Scroll the table horizontally to see all fields.
Code / Status / Meaning| Code | Status | Meaning |
|---|
invalid_api_key | 401 | The authorization header is missing or the key is unknown. |
|---|
insufficient_credits | 402 | The balance is below this call's cost. The response carries credits_required and credits_remaining. |
|---|
rate_limit_exceeded | 429 | Free keys share 10 calls a minute across every service. The response carries limit and window_seconds. |
|---|
services_unavailable | 503 | The credit store could not be reached. Retry once after 30 seconds. |
|---|
6 worked examples
Examples
Where the answer comes from
Source and scope
Computed in this process from the two documents supplied. Nothing is fetched and nothing is stored.
Attest reports what it read, with the source it read it from. It is general information, not advice, and not a legal record.
All Attest tools · Service list as JSON · OpenAPI