Compare two pieces of text

See exactly what changed between two versions, line by line, with additions and removals marked.

The original text.

The text to compare it against.

Options

Lines of unchanged context around each change.

0 to 100

1 credit

Needs A and B.

What it does

Also called: compare two pieces of text · find the difference between two texts · text comparison tool.

Use it from your own code

The same endpoint this page calls — no daily cap, 1 credit a call either way.

POST /v1/core/text-diff

curl -X POST "$DOATHING_API/v1/core/text-diff" \
  -H "x-api-key: $DOATHING_KEY" \
  -H "content-type: application/json" \
  -d '{"a": "one\ntwo\n", "b": "one\nthree\n"}'

See exactly what changed between two versions, line by line, with additions and removals marked.

Unified or context diff between two texts, with optional whitespace-insensitive comparison.

Response

The result carries your remaining balance alongside it, so you can track spend without a second call.

{
  "diff": "--- a\n+++ b\n@@ -1,2 +1,2 @@\n one\n-two\n+three",
  "added": 1,
  "removed": 1,
  "identical": false,
  "request_id": "37f01edb-0163-42a1-ac51-0acaef979800",
  "credits_remaining": 96
}

Cost

1 credit per call, whether it is run from the site or from the API — the credential differs, the price does not. A new account starts with 20 credits.

A rejected request still costs a credit: the authorizer decrements before the tool validates. A call rejected for a missing or invalid key is free.

Parameters

Generated from the endpoint’s own validation, so this is exactly what it accepts. A body field goes at the top level; an option goes inside options.

NameInTypeDefaultNotes
a *bodystring—The original text.
b *bodystring—The text to compare it against.
ignore_whitespaceoptionsbooleanfalseCompare lines with leading and trailing space removed.
context_linesoptionsinteger3Lines of unchanged context around each change. 0 to 100