---
title: "Check an invoice against a price model"
method: POST
path: "/v1/price-baseline/models/{id}/compare"
tags: ["Contract Pricing"]
---

# Check an invoice against a price model

`POST /v1/price-baseline/models/{id}/compare`

## Request

- Base URL: `https://api.talonic.com`
- URL: `https://api.talonic.com/v1/price-baseline/models/{id}/compare`
- Auth: HTTP bearer

Reads the invoice document with the extraction model, recomputes each billed price from the contract (each invoice month priced by the version in force then) and stores the comparison. Index values the invoice prints are kept as invoice-sourced values and flagged as not independent. The same invoice read against the same contract versions is read once; a repeat check reuses the stored extract. The call runs the extraction model in the request.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `invoice_document_id` string, uuid, required: Invoice document of the workspace.

## Response `201`

The stored comparison.

- PriceBaselineComparison: One invoice recomputed against a model.
  - `id` string, uuid
  - `customer_id` string, uuid
  - `model_id` string, uuid
  - `invoice_document_id` string, uuid
  - `invoice` PriceBaselineInvoiceExtract: What the extraction read from an invoice.
    - `source_hash` string, nullable: Hash of the extraction input; an equal hash reuses the extract.
    - `invoice_number` string, nullable
    - `document_kind` 'bill' | 'final' | 'instalment' | 'credit_note' | 'cancellation'
    - `corrects_invoice_number` string, nullable
    - `issuer` string, nullable
    - `truncated` object, nullable: Set when the invoice text was longer than the reader reads; lines past the cut are missing.
      - `chars` integer
      - `limit` integer
    - `invoice_date` string, nullable
    - `period_from` string, nullable
    - `period_to` string, nullable
    - `master` object: Master data as printed.
      - `customer` PriceBaselinePrinted, nullable: One printed field and the passage that prints it.
        - `value` string
        - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
          - `document_id` string, uuid, required
          - `quote` string, required: The passage exactly as the document prints it.
          - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
          - `problem` string: Why verification failed; absent when verified.
          - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
          - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
      - `customer_number` PriceBaselinePrinted, nullable: One printed field and the passage that prints it.
        - `value` string
        - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
          - `document_id` string, uuid, required
          - `quote` string, required: The passage exactly as the document prints it.
          - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
          - `problem` string: Why verification failed; absent when verified.
          - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
          - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
      - `supply_address` PriceBaselinePrinted, nullable: One printed field and the passage that prints it.
        - `value` string
        - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
          - `document_id` string, uuid, required
          - `quote` string, required: The passage exactly as the document prints it.
          - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
          - `problem` string: Why verification failed; absent when verified.
          - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
          - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
      - `contract_number` PriceBaselinePrinted, nullable: One printed field and the passage that prints it.
        - `value` string
        - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
          - `document_id` string, uuid, required
          - `quote` string, required: The passage exactly as the document prints it.
          - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
          - `problem` string: Why verification failed; absent when verified.
          - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
          - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
    - `readings` object[]
      - `meter` string, nullable
      - `label` string
      - `period_from` string, nullable
      - `period_to` string, nullable
      - `reading_start` number, nullable
      - `reading_end` number, nullable
      - `factor` number, nullable
      - `quantity` number, nullable
      - `unit` string, nullable
      - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
        - `document_id` string, uuid, required
        - `quote` string, required: The passage exactly as the document prints it.
        - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
        - `problem` string: Why verification failed; absent when verified.
        - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
        - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
    - `payments` object[]
      - `label` string
      - `date` string, nullable
      - `amount` number
      - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
        - `document_id` string, uuid, required
        - `quote` string, required: The passage exactly as the document prints it.
        - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
        - `problem` string: Why verification failed; absent when verified.
        - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
        - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
    - `totals` object: Printed totals, each present only when its quote verifies. Each entry is `{ value: number, evidence }` or null.
      - `net` object, nullable
      - `vat_rate` object, nullable
      - `vat` object, nullable
      - `gross` object, nullable
    - `lines` PriceBaselineInvoiceLine[]
      - `label` string
      - `component` string, nullable: Model component the line bills.
      - `period_from` string, nullable
      - `period_to` string, nullable
      - `quantity` number, nullable
      - `quantity_unit` string, nullable
      - `unit_price` number, nullable
      - `price_unit` string, nullable
      - `amount` number, nullable
      - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
        - `document_id` string, uuid, required
        - `quote` string, required: The passage exactly as the document prints it.
        - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
        - `problem` string: Why verification failed; absent when verified.
        - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
        - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
      - `remapped` string, nullable: Set when the line was read as a component not in force in its period and moved.
      - `tag_changed` object, nullable: Set when an earlier reading of the same invoice tagged this printed line with another component.
        - `previous` string, nullable
    - `stated_indices` object[]: Index values the invoice itself prints.
      - `variable` string
      - `period` string
      - `value` number
      - `unit` string, nullable
      - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
        - `document_id` string, uuid, required
        - `quote` string, required: The passage exactly as the document prints it.
        - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
        - `problem` string: Why verification failed; absent when verified.
        - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
        - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
  - `prices` PriceBaselineComponentPrice[]
    - `component` string: Component key.
    - `period` object
      - `label` string
      - `from` string: `YYYY-MM`.
      - `to` string: `YYYY-MM`.
    - `price` number, nullable
    - `unit` string
    - `status` 'ok' | 'missing_index' | 'missing_value' | 'rebase_mismatch' | 'unit_mismatch' | 'custom_reference' | 'formula_error'
    - `detail` string, nullable
    - `indices` object[]
      - `variable` string
      - `series` string
      - `months` string[]
      - `value` number, nullable
      - `sources` string[]
      - `independent` boolean
      - `rebase` object: Set when the published base differs from the contract's.
        - `contract_base` number
        - `published_base` number
        - `base_year_average` number
        - `link_value` number
      - `assumed` PriceBaselineAssumptionUse: Where a number rests on an assumption.
        - `id` string, uuid
        - `scope` 'contract' | 'workspace'
        - `target_kind` 'series' | 'variable' | 'quantity' | 'profile'
        - `target` string
        - `rule` 'value' | 'carry_forward' | 'proxy'
        - `value` number, nullable
        - `note` string, nullable
      - `from_invoice` string: Set when the published data could not price the period (this is the reason) and the invoice's own printed value was read.
    - `assumptions` PriceBaselineAssumptionUse[]: Every assumption this price rests on.
      - `id` string, uuid
      - `scope` 'contract' | 'workspace'
      - `target_kind` 'series' | 'variable' | 'quantity' | 'profile'
      - `target` string
      - `rule` 'value' | 'carry_forward' | 'proxy'
      - `value` number, nullable
      - `note` string, nullable
  - `comparison` PriceBaselineInvoiceComparison
    - `currency` string, nullable: ISO 4217 code of every amount in the comparison.
    - `lines` PriceBaselineLineComparison[]
      - `line` PriceBaselineInvoiceLine: One billed line as the invoice prints it.
        - `label` string
        - `component` string, nullable: Model component the line bills.
        - `period_from` string, nullable
        - `period_to` string, nullable
        - `quantity` number, nullable
        - `quantity_unit` string, nullable
        - `unit_price` number, nullable
        - `price_unit` string, nullable
        - `amount` number, nullable
        - `evidence` PriceBaselineEvidence, nullable: A verbatim passage from a workspace document backing one value.
          - `document_id` string, uuid, required
          - `quote` string, required: The passage exactly as the document prints it.
          - `verified` boolean, required: True only when the quote occurs in the document text and carries the value it backs.
          - `problem` string: Why verification failed; absent when verified.
          - `anchored` boolean: The extracted quote was a paraphrase and `quote` is the document line that prints the value.
          - `row` string: The whole table row a verified quote sits in, kept when its other cells print what the quote left out.
        - `remapped` string, nullable: Set when the line was read as a component not in force in its period and moved.
        - `tag_changed` object, nullable: Set when an earlier reading of the same invoice tagged this printed line with another component.
          - `previous` string, nullable
      - `baseline_price` number, nullable
      - `billed_price` number, nullable: Billed price converted into the component's unit.
      - `unit` string, nullable
      - `effect` number, nullable: Contract price minus billed price, times quantity and the invoice's own pro-rating factor, in the comparison's currency. Positive: billed less than the contract allows.
      - `verdict` 'match' | 'underbilled' | 'overbilled' | 'not_comparable'
      - `reason` string, nullable
      - `independent` boolean: True when every index behind the baseline came from an independent source.
      - `tier` 'owed' | 'estimated' | 'potential' | 'assumed' | 'null', nullable: How firmly a gap stands; set on underbilled and overbilled lines only.
      - `unbilled` boolean: A charge the contract prices for the invoice's period that the invoice does not bill; no printed line stands behind it.
      - `weights` object[]: When the line spans several price periods: each period's price and its share of the line.
        - `from` string
        - `to` string
        - `price` number
        - `share` number
      - `weighted_by` 'days' | 'consumption'
    - `totals` object
      - `underbilled` number
      - `overbilled` number
      - `compared_lines` integer
      - `not_comparable_lines` integer
    - `amendment_suspects` string[]: Base values that look superseded: consistent gaps an amendment would explain. Held out of the totals.
    - `document_kind` 'bill' | 'final' | 'instalment' | 'credit_note' | 'cancellation'
    - `completeness` object
      - `partial` boolean: True when lines may be missing: the text was cut, or the lines miss the printed net by more than the tolerance.
      - `truncated` boolean
      - `lines_net` number, nullable
      - `printed_net` number, nullable
      - `reconciliation` 'ok' | 'gap' | 'unknown'
      - `gap` number, nullable
  - `underbilled` number
  - `overbilled` number
  - `currency` string, nullable: ISO 4217 code of `underbilled`, `overbilled` and every amount in `comparison`.
  - `engine_version` integer, nullable: Pricing engine version the comparison was computed under.
  - `created_at` string, date-time

## Other responses

- `400`: The request is invalid.
- `404`: The requested resource was not found.
- `422`: The request is well-formed but violates the declared task contract.
- `502`: The extraction model is unavailable. The error is retryable.

## Changes

- **2026-10-28** `0a485a46163e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/talonic/apis/talonic-api/changes/v1/price-baseline/models/:id/compare/post.md)

---

[API](https://skmtc.dev/talonic/apis/talonic-api.md) - [All operations](https://skmtc.dev/talonic/apis/talonic-api/llms.txt) - [OpenAPI document](https://skmtc.dev/talonic/apis/talonic-api/revisions/9f6d53e2ab5e?raw)
