Skip to main content

Generate Strategy

Use AI to auto-suggest field mappings and strategies for a reference dataset. Analyses column names, data types, and sample values to recommend configs.

Let AI analyse your reference dataset and recommend field mappings, comparison strategies, and weights. The strategy generator examines column names, data types, and sample values to produce an optimal matching configuration. Use the generated strategy as a starting point or pass it directly to a smart-run.

The generated strategy document contains field_rules (per-field comparison rules with a rationale explaining why the AI chose that comparison type and weight), blocking_keys for candidate pre-filtering, thresholds for auto-commit and auto-reject bands, and notes on cardinality and data quality. You can optionally provide a user_prompt with natural language guidance (e.g. "prioritise date matching" or "vendor name is the most important field") to steer the generation.

Strategy generation does not modify any existing configs. The generated strategy is saved independently and can be applied to a config via the smart-run endpoint, or used as a reference when manually creating a config.
POST/v1/matching/strategies/generate

Body parameters

reference_data_id*stringID of the reference dataset to analyse.
target_type*stringTargeting mode to generate strategy for.
target_valueobjectTarget-specific values to include in strategy generation.
user_promptstringOptional natural language guidance for the AI (e.g. "prioritise date matching").

Response

Response fields

idstringStrategy UUID.
namestring | nullStrategy name.
matching_config_idstring | nullConfig this strategy is associated with.
strategyobjectGenerated strategy document: reasoning_summary, cardinality, data_quality_notes, blocking_keys, field_rules, thresholds, edge_cases.
versionintegerStrategy version number.
version_hashstringHash of the strategy content for change detection.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 last update timestamp.
links.selfstringURL to this strategy.

Response

{
  "id": "f6a7b8c9-d0e1-2345-fab2-456789012345",
  "name": null,
  "matching_config_id": null,
  "strategy": {
    "reasoning_summary": "Match invoices to the vendor master via vendor name with date and amount corroboration.",
    "cardinality": { "expected": "N:1", "rationale": "Many invoices map to one vendor row." },
    "data_quality_notes": ["Vendor names carry legal-form suffixes (GmbH, Ltd)."],
    "blocking_keys": [
      { "extracted_field": "vendor_name", "reference_field": "name", "transform": "first_n_chars", "transform_param": 4, "rationale": "Cheap candidate pre-filter on the name prefix." }
    ],
    "field_rules": [
      { "extracted_field": "vendor_name", "reference_field": "name", "comparison_type": "fuzzy_string", "weight": 0.4, "rationale": "High cardinality text; fuzzy handles name variations." },
      { "extracted_field": "invoice_date", "reference_field": "date", "comparison_type": "date_range", "weight": 0.3, "tolerance_days": 5, "rationale": "Range comparison tolerates minor discrepancies." },
      { "extracted_field": "total_amount", "reference_field": "total", "comparison_type": "numeric_range", "weight": 0.3, "tolerance_pct": 1, "rationale": "Range accounts for rounding differences." }
    ],
    "thresholds": { "auto_commit": 0.85, "auto_reject": 0.30 },
    "edge_cases": []
  },
  "version": 1,
  "version_hash": "a1b2c3d4e5f6",
  "created_at": "2024-10-03T10:00:00.000Z",
  "updated_at": "2024-10-03T10:00:00.000Z",
  "links": {
    "self": "/v1/matching/strategies/f6a7b8c9-d0e1-2345-fab2-456789012345"
  }
}

Errors

Error responses

400validation_errorreference_data_id or target_type is missing.
401unauthorizedMissing or invalid API key.
404not_foundThe specified reference_data_id does not exist for your workspace.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.