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 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.

This is distinct from 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 matched, min_confidence sets the floor, and allow_review_on_expected decides whether a soft miss on an expected type drops to review instead of failing.

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

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.

Request body

{
  "name": "Shipment bundle",
  "document_type_configs": [
    {
      "document_type": "invoice",
      "matching_config_id": "mc_uuid_1",
      "presence": "required"
    },
    {
      "document_type": "delivery_note",
      "matching_config_id": "mc_uuid_2",
      "presence": "expected"
    },
    {
      "document_type": "contract",
      "matching_config_id": "mc_uuid_3",
      "presence": "optional"
    }
  ],
  "pass_criteria": {
    "all_required_matched": true,
    "min_confidence": 0.8,
    "allow_review_on_expected": true
  }
}

Response

{
  "id": "pkg_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Shipment bundle",
  "document_type_configs": [
    { "document_type": "invoice", "matching_config_id": "mc_uuid_1", "presence": "required" },
    { "document_type": "delivery_note", "matching_config_id": "mc_uuid_2", "presence": "expected" },
    { "document_type": "contract", "matching_config_id": "mc_uuid_3", "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/pkg_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "runs": "/v1/matching/packages/runs?package_config_id=pkg_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

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.