Attest tools · text_diff

Text and JSON compare

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.

1 credit per successful callPOST /api/v1/diff

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
FieldTypeRequiredWhat it does
astringRequiredThe first version. Up to 1,000,000 characters.
bstringRequiredThe second version. a and b together are capped at 1,500,000 characters.
modestringOptionallines (default), words, chars or json.
ignore_whitespacebooleanOptionalTreat runs of whitespace as equal.
ignore_casebooleanOptionalCompare without case.
context_linesintegerOptionalLines 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
FieldWhat it holds
modeThe mode that ran.
unitWhat a change is counted in: lines, words, characters or JSON pointers.
identicalWhether the two sides are the same.
statsAdded, removed and, for json, changed counts.
changesEach change, with its position.
unified_patchA unified diff, for the text modes.
coarseTrue when chars mode fell back to block-level changes rather than taking longer.
truncatedWhether the change list stopped at a cap.
optionsThe 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
CodeStatusMeaning
a_required400No a was sent.
b_required400No b was sent.
input_too_long400a and b together are past the combined cap; the response carries the limit.
too_many_lines400The two sides have more lines together than the cap.
invalid_json_a400mode json was used and a is not valid JSON.
invalid_json_b400mode json was used and b is not valid JSON.
json_too_deep400A JSON document nests deeper than the cap.
diff_too_complex502The comparison did not finish inside the budget. Not charged.

On every service

Scroll the table horizontally to see all fields.

Code / Status / Meaning
CodeStatusMeaning
invalid_api_key401The authorization header is missing or the key is unknown.
insufficient_credits402The balance is below this call's cost. The response carries credits_required and credits_remaining.
rate_limit_exceeded429Free keys share 10 calls a minute across every service. The response carries limit and window_seconds.
services_unavailable503The credit store could not be reached. Retry once after 30 seconds.

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

Same key as every Attest tool

One key. One balance. 1 credit a call.

Issue a free key, then use it here, on Attest Capture and on every other tool in the box.

Get a free key