Skip to main content

Save Reconciliation Config

Save or clear the reconciliation config for a reference dataset. Define anchor key columns, narrowing columns, ReDoS-checked key patterns, and column rules.

Persist the reconciliation config for a reference dataset. The config is stored as JSONB on the dataset and is validated at the boundary, so the persisted payload is always well-formed. Sending an empty body ({}) clears the stored config.

The anchor block controls how a document is matched to a reference row. key_columns are indexed for lookup, narrowing_columns disambiguate when several rows match the same key, and key_patterns are per-column regexes that a markdown token must match before it is eligible to anchor. The columns map assigns each reference column a role of validate, extract, or anchor, plus optional type, tolerance, threshold, and required settings.

Each key_patterns regex is checked for catastrophic backtracking before it is persisted. A pattern that could hang on a crafted input is rejected, because every later reconciliation run would otherwise inherit that risk. This guard mirrors the format-constraint ReDoS protection used elsewhere in the platform.

This endpoint requires the write scope and is rejected in master view. A request scoped to all tenants (customerId "all") cannot save a config, because that would let an admin overwrite any tenant's settings.
PUT/v1/reconciliation/config/{referenceDataId}

Path parameters

referenceDataId*stringUUID of the reference dataset. Must belong to your organization.

Body parameters

namestringOptional config name (max 200 characters).
descriptionstringOptional description (max 2000 characters).
versionintegerOptional config version number.
anchorobjectAnchor sub-config: key_columns, narrowing_columns, key_patterns, markdown_scanning.
anchor.key_columnsstring[]Reference columns to index for anchor lookup.
anchor.narrowing_columnsstring[]Columns used to disambiguate multiple anchor matches.
anchor.key_patternsobjectPer-column regex patterns. Validated for catastrophic backtracking before persist.
anchor.markdown_scanningstringWhen to scan markdown for anchors: fallback, always, or disabled.
columnsobjectPer-column rules keyed by reference column name.
columns[].role*stringColumn role: validate, extract, or anchor.
columns[].typestringCheck type for validate columns (e.g. numeric_tolerance, fuzzy_name).
columns[].tolerancenumberTolerance for numeric checks.
columns[].thresholdnumberSimilarity threshold for fuzzy checks.
columns[].requiredbooleanWhether a fail on this column blocks reconciled status.
columns[].doc_type_scopestring[]Document types this rule applies to.
haiku_validationbooleanWhether per-document LLM validation runs on anchored rows.

Response

Response fields

savedbooleanAlways true on a successful save.

Request body

{
  "name": "Carrier reconciliation",
  "anchor": {
    "key_columns": ["booking_ref"],
    "narrowing_columns": ["carrier_name"],
    "key_patterns": { "booking_ref": "^[A-Z]{3}[0-9]{7}$" },
    "markdown_scanning": "fallback"
  },
  "columns": {
    "freight_amount": { "role": "validate", "type": "numeric_tolerance", "tolerance": 0.02, "required": true },
    "consignee": { "role": "validate", "type": "fuzzy_name", "threshold": 0.85 }
  },
  "haiku_validation": true
}

Response

{
  "saved": true
}

Errors

Error responses

400bad_requestInvalid body, a key_patterns regex flagged for catastrophic backtracking, or a request in master view.
401unauthorizedMissing or invalid API key.
404not_foundNo reference dataset with this ID exists for your organization.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.