# Compare figures

Recompute and compare figures you already extracted.

Documentation index: https://webcite.co/llms.txt
Canonical page: https://webcite.co/api-docs/conflicts
API origin: https://api.webcite.co
Authentication: x-api-key header. Keep keys on your server.

## When to use it

Compare figures only when entity, period, unit, currency, scale, basis, and definition are compatible. Include source-linked `fxRates` for currency conversion and reviewed `precedenceRules` only where justified. A missing comparison is not a clean result.

## Request

POST /api/v1/analyze/conflicts

1 credit.

### curl

```curl
curl --fail-with-body -X POST 'https://api.webcite.co/api/v1/analyze/conflicts' \
  -H "x-api-key: $WEBCITE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "figures": [
    {
      "metric": "revenue",
      "value": 12,
      "unit": "currency",
      "currency": "USD",
      "period": "FY2025",
      "decimalValue": "12",
      "provenance": {
        "assetId": "YOUR_ASSET_ID",
        "sheet": "Income statement",
        "cell": "B2",
        "documentName": "Example annual report",
        "method": "rule"
      }
    }
  ]
}'
```

### Node.js

```javascript
const response = await fetch("https://api.webcite.co/api/v1/analyze/conflicts", {
  method: "POST",
  headers: {
    "x-api-key": process.env.WEBCITE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "figures": [
    {
      "metric": "revenue",
      "value": 12,
      "unit": "currency",
      "currency": "USD",
      "period": "FY2025",
      "decimalValue": "12",
      "provenance": {
        "assetId": "YOUR_ASSET_ID",
        "sheet": "Income statement",
        "cell": "B2",
        "documentName": "Example annual report",
        "method": "rule"
      }
    }
  ]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
```

### python

```python
import os
import json
import requests

payload = json.loads("{\n  \"figures\": [\n    {\n      \"metric\": \"revenue\",\n      \"value\": 12,\n      \"unit\": \"currency\",\n      \"currency\": \"USD\",\n      \"period\": \"FY2025\",\n      \"decimalValue\": \"12\",\n      \"provenance\": {\n        \"assetId\": \"YOUR_ASSET_ID\",\n        \"sheet\": \"Income statement\",\n        \"cell\": \"B2\",\n        \"documentName\": \"Example annual report\",\n        \"method\": \"rule\"\n      }\n    }\n  ]\n}")
response = requests.post(
    "https://api.webcite.co/api/v1/analyze/conflicts",
    headers={"x-api-key": os.environ["WEBCITE_API_KEY"]},
    json=payload,
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response

Returns conflicts, recomputations, and review information. The current public schema describes the request figures but does not define the complete response.

## Errors

For 400, check the request fields and source identifiers. For 401, check your API key. For 429, wait for the retry interval. See the errors guide before retrying a billable request.

## OpenAPI operation

```json
{
  "path": "/api/v1/analyze/conflicts",
  "method": "POST",
  "operation": {
    "description": "Verify NUMBERS, not just text. Given figures extracted across one or more documents, the finance accuracy engine:\n\n- **recomputes** every derivable metric from its primitives (e.g. gross margin from revenue and COGS, revenue growth from two periods) and flags where the stated value does not match the computed one;\n- **detects cross-document conflicts** — figures for the same metric/entity/period that disagree beyond the metric's tolerance;\n- **flags semantic conflicts** — metrics that are each plausible alone but jointly impossible (e.g. logo retention far below 100 − churn);\n- returns a **review** flag: whether a human should look, and the concrete reasons (a conflict, a recompute mismatch, or model-read inputs). The findings are deterministic — a conflict exists or it does not — so this is a flag with reasons, not a probability score.\n\nDeterministic compute, no LLM calls. **Cost: 1 credit.** Still subject to your plan's rate limits, since the request uses server compute.",
    "operationId": "ApiV1Controller_analyzeConflicts",
    "parameters": [],
    "requestBody": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnalyzeConflictsRequestDto"
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "description": "Conflicts, recomputations, and a review flag"
      },
      "401": {
        "description": "Unauthorized - API key required"
      },
      "429": {
        "description": "Rate limit exceeded"
      }
    },
    "security": [
      {
        "x-api-key": []
      },
      {
        "bearer": []
      }
    ],
    "summary": "Analyze numeric figures for conflicts and mismatches",
    "tags": [
      "Public API"
    ]
  },
  "schemas": {
    "AnalyzeConflictsRequestDto": {
      "properties": {
        "figures": {
          "description": "Figures extracted across one or more documents. The engine groups compatible entities, periods, currencies, scales, bases and definitions, recomputes derivable metrics, and reports conflicts or unavailable comparisons.",
          "items": {
            "$ref": "#/components/schemas/FigureDto"
          },
          "type": "array"
        },
        "fxRates": {
          "description": "Source-linked FX observations. A rate is used only for its exact applicable period and declared conversion direction.",
          "items": {
            "$ref": "#/components/schemas/FxRateDto"
          },
          "type": "array"
        },
        "precedenceRules": {
          "description": "Reviewed, scope-exact decisions that select one observation and enumerate every superseded competing identity.",
          "items": {
            "$ref": "#/components/schemas/ObservationPrecedenceDto"
          },
          "type": "array"
        }
      },
      "required": [
        "figures"
      ],
      "type": "object"
    },
    "FigureDto": {
      "properties": {
        "basis": {
          "description": "Whether the figure is actual, forecast, assumed or unknown.",
          "enum": [
            "actual",
            "forecast",
            "assumption",
            "unknown"
          ],
          "type": "string"
        },
        "currency": {
          "description": "Currency code of the normalized value.",
          "type": "string"
        },
        "decimalValue": {
          "description": "Canonical decimal text used for exact arithmetic. Without it the figure can be reported but not recomputed.",
          "example": "62.125",
          "type": "string"
        },
        "definition": {
          "description": "Definition or accounting-policy scope.",
          "type": "string"
        },
        "entity": {
          "description": "Entity scope, e.g. \"subscription\".",
          "type": "string"
        },
        "metric": {
          "description": "Metric dictionary key, e.g. \"gross_margin\".",
          "example": "gross_margin",
          "type": "string"
        },
        "observationId": {
          "description": "Immutable observation identity. Exact replay may reuse it.",
          "type": "string"
        },
        "period": {
          "description": "Period, e.g. \"FY2024\".",
          "type": "string"
        },
        "provenance": {
          "$ref": "#/components/schemas/ProvenanceDto"
        },
        "scale": {
          "description": "Scale qualifier for the already-normalized value. This does not apply another conversion.",
          "type": "string"
        },
        "unit": {
          "description": "Canonical unit.",
          "enum": [
            "percent",
            "multiple",
            "currency",
            "ratio",
            "count",
            "months"
          ],
          "type": "string"
        },
        "value": {
          "description": "Value normalized to the metric canonical unit.",
          "example": 62,
          "type": "number"
        }
      },
      "required": [
        "metric",
        "value",
        "unit",
        "provenance"
      ],
      "type": "object"
    },
    "ProvenanceDto": {
      "properties": {
        "assetId": {
          "description": "Asset the figure came from.",
          "type": "string"
        },
        "cell": {
          "description": "Cell reference, e.g. B4.",
          "type": "string"
        },
        "documentName": {
          "description": "Human-readable document name.",
          "type": "string"
        },
        "method": {
          "description": "How the value was extracted.",
          "enum": [
            "rule",
            "model"
          ],
          "type": "string"
        },
        "page": {
          "description": "1-based page.",
          "type": "number"
        },
        "sheet": {
          "description": "Sheet name.",
          "type": "string"
        }
      },
      "required": [
        "assetId",
        "documentName",
        "method"
      ],
      "type": "object"
    },
    "FxRateDto": {
      "properties": {
        "applicableDate": {
          "example": "2025-12-31",
          "type": "string"
        },
        "applicablePeriod": {
          "type": "string"
        },
        "decimalRate": {
          "description": "Canonical decimal rate used by exact arithmetic.",
          "example": "1.08425",
          "type": "string"
        },
        "direction": {
          "enum": [
            "multiply",
            "divide"
          ],
          "type": "string"
        },
        "fromCurrency": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "provenance": {
          "$ref": "#/components/schemas/ProvenanceDto"
        },
        "rate": {
          "type": "number"
        },
        "ruleRevision": {
          "type": "string"
        },
        "toCurrency": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "fromCurrency",
        "toCurrency",
        "rate",
        "decimalRate",
        "direction",
        "applicablePeriod",
        "applicableDate",
        "ruleRevision",
        "provenance"
      ],
      "type": "object"
    },
    "ObservationPrecedenceDto": {
      "properties": {
        "basis": {
          "enum": [
            "actual",
            "forecast",
            "assumption",
            "unknown"
          ],
          "type": "string"
        },
        "currency": {
          "type": "string"
        },
        "definition": {
          "type": "string"
        },
        "entity": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metric": {
          "type": "string"
        },
        "period": {
          "type": "string"
        },
        "provenance": {
          "$ref": "#/components/schemas/ProvenanceDto"
        },
        "reason": {
          "type": "string"
        },
        "reviewerId": {
          "type": "string"
        },
        "ruleRevision": {
          "type": "string"
        },
        "scale": {
          "type": "string"
        },
        "selectedObservationId": {
          "type": "string"
        },
        "supersededObservationIds": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "id",
        "metric",
        "selectedObservationId",
        "supersededObservationIds",
        "reviewerId",
        "reason",
        "ruleRevision",
        "entity",
        "period",
        "currency",
        "scale",
        "basis",
        "definition",
        "provenance"
      ],
      "type": "object"
    }
  }
}
```
