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 optimal matching configurations.

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.

Each generated strategy includes a rationale per field mapping explaining why the AI chose that strategy and weight. 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

Response

Response fields

idstringStrategy UUID.
namestring | nullStrategy name.
matching_config_idstring | nullConfig this strategy is associated with.
strategyobjectGenerated strategy object containing field mappings and thresholds.
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": {
    "field_mappings": [
      { "source": "vendor_name", "target": "name", "strategy": "fuzzy", "weight": 0.4, "rationale": "High cardinality text — fuzzy handles name variations." },
      { "source": "invoice_date", "target": "date", "strategy": "date_range", "weight": 0.3, "rationale": "Date field — range comparison tolerates minor discrepancies." },
      { "source": "total_amount", "target": "total", "strategy": "numeric_range", "weight": 0.3, "rationale": "Numeric field — range accounts for rounding differences." }
    ],
    "threshold": 0.85
  },
  "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.