Skip to main content

Open Inputs and Enrichment

Fill the gaps of a price model with sourced values: set a contract value with its quote, enrich from contract documents, and record how an open input is filled.

A price model is rarely complete after extraction. A value may be printed in an annex, a quantity may be agreed in an offer, an index may be missing for a month. The contract workbook turns each gap into an open input: a question with the ways to answer it. Four routes close those gaps, and none of them invents a number. A contract value is set only together with a quote that occurs in the contract document and prints the value; an enrichment answer counts only when its quote occurs in the document it names; a decision about how an input will be filled never fills a number.

Open inputs are listed in the open array of the workbook (GET /v1/price-baseline/models/{id}/sheets). Each has a stable key (value:<document>:<name>, index:<series> or invoice), a kind (contract_value, index_value, quantity, profile or invoice), the question, and the options that answer it: enter_contract_value, enter_published, from_invoice, request, upload_invoice or assume. An input marked optional improves the result but nothing is missing without it.

POST/v1/price-baseline/models/{id}/values

Body fields

variable*stringName of a non-index variable of the model. Up to 64 characters.
value*numberThe value.
quote*stringThe passage of the contract that prints the value. Up to 2000 characters. It must occur in the model's contract document and print the value, otherwise nothing is saved (422).

cURL: Set a base price with its quote

curl -X POST "https://api.talonic.com/v1/price-baseline/models/7b1f0a52-3c9d-4e08-a6d4-51c2e8f7b3a9/values" \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"variable": "AP0", "value": 6.42, "quote": "Der Basis-Arbeitspreis AP0 betraegt 6,42 ct/kWh."}'
POST/v1/price-baseline/models/{id}/enrich

Path parameters

id*uuidModel id.

Use enrich when a model was corrected by hand and only lacks its identity (contract number, customer, site) and its agreed quantities. It leaves formulas and values alone. The route returns the enriched model with status 201 and answers 502 with a retryable error when the extraction model is unavailable.

POST/v1/price-baseline/models/{id}/enrich-documents

Body fields (all optional)

dry_runbooleanReport what would be filled without saving.
use_opusbooleanUse the stronger model for long documents the default model finds nothing in.
yearintegerYear whose open inputs are asked for, 2000 to 2100. Default: the last full year.

Response fields (201)

data.contract_keystring | nullThe contract the report is for.
data.dry_runbooleanWhether anything was saved.
data.wantedintegerNumber of open values asked for. When nothing is open it is 0 and no documents are listed.
data.documents[]arrayThe documents asked, each with the label used in the prompt (D1, D2, ...) and filename.
data.values[]arrayOne entry per answer: item, kind (contract_value or quantity), label, target, value, unit, base_period, document, document_id, quote, verified, problem, applied.
data.appliedintegerHow many values were written to the model.

cURL: Preview what the documents can fill

curl -X POST "https://api.talonic.com/v1/price-baseline/models/7b1f0a52-3c9d-4e08-a6d4-51c2e8f7b3a9/enrich-documents" \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dry_run": true, "year": 2025}'

Response: 201 Enrichment report (excerpt)

{
  "data": {
    "contract_key": "4711",
    "dry_run": true,
    "wanted": 2,
    "documents": [
      { "id": "D1", "filename": "Waermeliefervertrag_4711.pdf" },
      { "id": "D2", "filename": "Angebot_4711_Anlage.pdf" }
    ],
    "values": [
      {
        "item": "I1",
        "kind": "quantity",
        "label": "Vereinbarte Waermemenge",
        "target": "Q",
        "value": 1850000,
        "unit": "kWh",
        "document": "Angebot_4711_Anlage.pdf",
        "document_id": "5e92c8a1-0b37-4d6f-a1c4-7f3d8b2e6091",
        "quote": "Jahreswaermebedarf 1.850.000 kWh",
        "verified": true,
        "applied": false
      }
    ],
    "applied": 0
  }
}

A value counts only when its quote occurs in the document the answer names and prints it, and it never replaces a verified value. With dry_run nothing is saved, so the report shows exactly which values would be written. An answer with verified: false carries a problem that says why the quote failed.

POST/v1/price-baseline/models/{id}/decide

Body fields

key*stringKey of the open input, from the open list of the workbook. Up to 300 characters.
choicestring | nullfrom_invoice takes the value from the invoice once it is ingested; request asks the customer or supplier. null clears the decision.
notestring | nullFree-text note, up to 2000 characters.

Response fields (201)

keystringThe input key.
decisionobject | nullThe stored decision (choice, note, decided_at), or null when it was cleared.

cURL: Mark an input as to be requested

curl -X POST "https://api.talonic.com/v1/price-baseline/models/7b1f0a52-3c9d-4e08-a6d4-51c2e8f7b3a9/decide" \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key": "index:destatis.erdgas.boerse", "choice": "request", "note": "Ask the supplier for the March value."}'
A decision is a note about intent, not data. Choosing from_invoice or request does not fill the number, and the price that depends on the input stays open until a sourced value exists. The decision is stored on the chain head's model, survives edits and re-extraction, and is cleared with choice: null.

Frequently asked questions

Why was my value refused with a 422?+
The quote must occur in the model's contract document and print the value, otherwise nothing is saved. A quote that is a paraphrase, that is printed in a different document, or that does not show the number fails this check. Copy the passage as the document prints it.
When should I use enrich and when enrich-documents?+
Use enrich when a model already has its prices and only lacks the contract number, customer, site and agreed quantities of its own contract document. Use enrich-documents to ask across every document of the contract for the specific open values and missing plan quantities of the workbook.
Does choosing from_invoice fill the value?+
No. A decision never fills a number. It records that the value will be taken from the invoice once it is ingested, so the open input shows that intent. The price stays open until a sourced value exists, either from the invoice check or from an entered value with its quote.
Can enrich-documents overwrite a value I verified?+
No. An answer counts only when its quote occurs in the document it names and prints the value, and it never replaces a verified value. Use dry_run to preview which values would be written before saving.