POST /v1/core/text-diff

Text diff

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

Compare two pieces of text now No key, no code — 1 credit either way.

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 *bodystringThe original text.
b *bodystringThe 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