Skip to main content

Discrepancy Runs

Compare a batch of documents for facts they state differently with a discrepancy run, and read each disagreement with its severity, values and quotes.

A discrepancy run compares a batch of documents and finds the facts they state differently, for instance two documents that give different totals, dates or party names for the same subject. It is the right tool when no rule exists yet and the question is only whether the documents agree with each other. For judging documents against a framework's rules, use evaluations; for judging a group of documents together against rules, use document sets.

A run starts with POST /v1/compliance/discrepancy-runs, returns at once, waits for the text of every document, and then makes one model call. With the external decider the run waits as a task for the workspace's own agent instead (status: "waiting"). A run is pending, processing, waiting, completed or error; a processing run older than the staleness limit reads as error.

Counts and lists consider only documents whose framework is ON. documents[].active tells whether a document's framework is ON, discrepancy_count counts the discrepancies at least two active documents still disagree on, and active_document_count counts the documents that take part. The detail route lists only the discrepancies at least two documents of ON frameworks still disagree on, with only those documents' values, so turning a framework OFF removes it from a run's result without deleting the run.

POST/v1/compliance/discrepancy-runs

Body fields

document_ids*string[] (uuid)2 to 50 documents. The configured maximum (20 by default) applies on top, and a document id that is not found returns 404.

cURL: Compare two documents

curl -X POST "https://api.talonic.com/v1/compliance/discrepancy-runs" \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"document_ids": ["5b7e2a91-6c44-4d0f-9a3e-71c8d2f0b6a5", "a83c06d2-9e1f-4b57-8c20-4d7f1e95a6b3"]}'
GET/v1/compliance/discrepancy-runs

Run fields

idstring (uuid)The run.
statusstringpending, processing, waiting, completed or error.
errorstring | nullWhy the run failed.
documents[]arrayThe batch: id, filename, deleted and active (whether the document's framework is ON).
discrepancy_countintegerDiscrepancies at least two active documents still disagree on.
active_document_countintegerDocuments of the batch whose framework is ON.
decided_bystring | nullThe external agent's label when the platform's model did not compare.
created_at / finished_atstring (date-time)When the run started and finished (null until then).
GET/v1/compliance/discrepancy-runs/{runId}

Discrepancy fields

discrepancies[].idstring (uuid)The discrepancy.
discrepancies[].subjectstringWhat the documents disagree about.
discrepancies[].severitystringhigh, medium or low.
discrepancies[].explanationstring | nullWhy the values conflict.
discrepancies[].values[]arrayPer document: document_id, value and quote.

Response: 200 Run with one discrepancy (excerpt)

{
  "id": "7c4e19a3-5f08-4d62-b1a7-e3908d56c2f4",
  "status": "completed",
  "error": null,
  "documents": [
    { "id": "5b7e2a91-6c44-4d0f-9a3e-71c8d2f0b6a5", "filename": "supplier-contract.pdf", "deleted": false, "active": true },
    { "id": "a83c06d2-9e1f-4b57-8c20-4d7f1e95a6b3", "filename": "declaration.pdf", "deleted": false, "active": true }
  ],
  "discrepancy_count": 1,
  "active_document_count": 2,
  "decided_by": null,
  "created_at": "2026-10-20T11:02:44.000Z",
  "finished_at": "2026-10-20T11:03:21.000Z",
  "discrepancies": [
    {
      "id": "d905e3b8-2a61-4f7c-8e04-6b1c7a52f093",
      "subject": "Supplier legal name",
      "severity": "medium",
      "explanation": "The two documents name different legal entities.",
      "values": [
        { "document_id": "5b7e2a91-6c44-4d0f-9a3e-71c8d2f0b6a5", "value": "ACME GmbH", "quote": "between ACME GmbH and the Buyer" },
        { "document_id": "a83c06d2-9e1f-4b57-8c20-4d7f1e95a6b3", "value": "ACME Ltd", "quote": "Supplier: ACME Ltd" }
      ]
    }
  ]
}
Discrepancy runs are available through the API. The Compliance app's screens show failed checks of evaluations, not comparisons, so read a comparison here rather than expecting it in the app.

Frequently asked questions

What is the difference between a discrepancy run and a set evaluation?+
A discrepancy run needs no rules: it finds facts the documents state differently. A set evaluation judges the documents together against the rules of the ON frameworks (or a rule set). Use a run to find disagreements, and an evaluation to check requirements.
Why is a discrepancy missing from a finished run?+
The detail lists only the discrepancies that at least two documents of ON frameworks still disagree on. If a framework was turned OFF after the run, its documents' values no longer count and discrepancies that depended on them drop out.
How many documents can I compare?+
From 2 up to the configured maximum, 20 by default; the request schema accepts up to 50 ids. An unknown document id returns 404 and a batch outside the allowed size returns 422.