Skip to main content

Create Package Config

Create a matching package config: a group of matching configs keyed by document type, with per-type presence rules and a package-level pass/fail criteria.

Package matching is a mode of Talonic's Matching family: it scores a bundle of documents of different types (for example an invoice, a delivery note, and a contract) against reference data in one governed run. A package config groups one matching config per document type, sets how strictly each type must be present, and defines the criteria that turn the per-type results into a single package verdict.

Within the Matching family, this sits one layer above the simpler single-document matching under /v1/matching. There, one config matches one document type against one reference dataset. A package config orchestrates several of those configs at once and produces a package-level passed, failed, or review outcome across the whole bundle.

Each entry in document_type_configs names a document_type, the matching_config_id that scores documents of that type, and a presence of required, expected, or optional. The pass_criteria block then aggregates: all_required_matched enforces that every required type reached a full match, min_confidence sets the confidence floor a required type must clear, and allow_review_on_expected decides whether a review-grade result on a supplied expected document drops the package to review instead of failing it.

The presence tiers behave asymmetrically at run time, so choose them deliberately. A missing or unmatched required type fails the package outright, as does a required type whose confidence falls below min_confidence. An expected type that is missing from the input never fails the package — it flags the run for review. An expected type that was supplied but did not match fails the package, and one that matched at review grade fails unless allow_review_on_expected is true. optional types are skipped when absent and never fail the package.

Create the per-type matching configs first under /v1/matching, then reference their IDs here. A package config is a thin orchestration layer over configs that already exist.
POST/v1/matching/packages/configs

Body parameters

name*stringPackage config name (1–200 characters).
document_type_configs*arrayOne slot per document type. Must contain at least one entry.
document_type_configs[].document_type*stringThe document type this slot scores (1–200 characters).
document_type_configs[].matching_config_id*stringUUID of the matching config that scores this type.
document_type_configs[].presence*stringHow strictly this type must be present: required, expected, or optional.
pass_criteria*objectPackage-level pass/fail aggregation rules.
pass_criteria.all_required_matched*booleanWhether every required type must reach a full match (not review) for the package to pass.
pass_criteria.min_confidence*numberConfidence floor (0–1). A required type scoring below it fails the package.
pass_criteria.allow_review_on_expected*booleanWhether a review-grade result on a supplied expected document drops the package to review instead of failing it.

Response

Response fields

idstringPackage config UUID.
namestringPackage config name.
document_type_configsarrayThe document-type slots as saved.
pass_criteriaobjectThe pass/fail aggregation rules as saved.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last-update timestamp.
links.selfstringURL of this config.
links.runsstringURL listing runs for this config.

curl

curl -X POST https://api.talonic.com/v1/matching/packages/configs \
  -H "Authorization: Bearer tlnc_your_api_key" \
  -H "Content-Type: application/json" \
  -d @package-config.json

Request body (package-config.json)

{
  "name": "Shipment bundle",
  "document_type_configs": [
    {
      "document_type": "invoice",
      "matching_config_id": "1a2b3c4d-5e6f-4781-92a3-b4c5d6e7f809",
      "presence": "required"
    },
    {
      "document_type": "delivery_note",
      "matching_config_id": "2b3c4d5e-6f70-4192-a3b4-c5d6e7f8091a",
      "presence": "expected"
    },
    {
      "document_type": "contract",
      "matching_config_id": "3c4d5e6f-7081-42a3-b4c5-d6e7f8091a2b",
      "presence": "optional"
    }
  ],
  "pass_criteria": {
    "all_required_matched": true,
    "min_confidence": 0.8,
    "allow_review_on_expected": true
  }
}

Response

{
  "id": "4f2a9c1e-8b3d-47e6-9a05-c7d1e2f3a4b5",
  "name": "Shipment bundle",
  "document_type_configs": [
    { "document_type": "invoice", "matching_config_id": "1a2b3c4d-5e6f-4781-92a3-b4c5d6e7f809", "presence": "required" },
    { "document_type": "delivery_note", "matching_config_id": "2b3c4d5e-6f70-4192-a3b4-c5d6e7f8091a", "presence": "expected" },
    { "document_type": "contract", "matching_config_id": "3c4d5e6f-7081-42a3-b4c5-d6e7f8091a2b", "presence": "optional" }
  ],
  "pass_criteria": {
    "all_required_matched": true,
    "min_confidence": 0.8,
    "allow_review_on_expected": true
  },
  "created_at": "2024-09-14T10:32:00.000Z",
  "updated_at": "2024-09-14T10:32:00.000Z",
  "links": {
    "self": "/v1/matching/packages/configs/4f2a9c1e-8b3d-47e6-9a05-c7d1e2f3a4b5",
    "runs": "/v1/matching/packages/runs?package_config_id=4f2a9c1e-8b3d-47e6-9a05-c7d1e2f3a4b5"
  }
}

Errors

Error responses

400bad_requestInvalid body: missing name, empty document_type_configs, an invalid matching_config_id UUID, or min_confidence outside 0–1.
401unauthorizedMissing or invalid API key.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.

Frequently asked questions

How is a package config different from a /v1/matching config?+
A /v1/matching config matches one document type against one reference dataset. A package config bundles several of those configs by document type and aggregates them into one pass/fail verdict for the whole document set.
What does presence control?+
presence sets how strictly each document type must be present. A missing or unmatched required type fails the package; a missing expected type flags the run for review (a supplied-but-unmatched one fails it); optional types are skipped when absent and never affect the verdict.
Do I create the matching configs here?+
No. Create the per-type matching configs under /v1/matching first, then reference their UUIDs in document_type_configs.
Does min_confidence apply to every document type?+
It is enforced on required types: a required type whose confidence lands below the floor fails the package even if it technically matched. Expected and optional types are governed by their match status and allow_review_on_expected, not the floor.