Skip to main content

Save Reconciliation Config

Save or clear the reconciliation config for a reference dataset. Define anchor key columns, narrowing columns, key patterns, and per-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}

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.