Reconciliation

Create matching rule

Create a reconciliation matching rule with the Python SDK.

POST/reconciliation/matching-rules

Use blnk.reconciliation.create_matching_rule to create a matching rule.

Call the method

response = blnk.reconciliation.create_matching_rule({
  "name": "Amount match",
  "description": "Match by amount with 1% drift",
  "criteria": [
    {
      "field": "amount",
      "operator": "equals",
      "allowable_drift": 0.01
    },
    {
      "field": "currency",
      "operator": "equals"
    },
    {
      "field": "reference",
      "operator": "contains"
    },
  ],
})
FieldTypeDescription
namestrName of the matching rule.
descriptionstrShort description of what the rule does.
criterialist[dict]Array of match criteria. Each entry sets how one field is compared.
criteria.
[].field
strField to match: amount, currency, reference, description, or date.
criteria.
[].operator
strHow to compare the field: equals or contains.
criteria.
[].allowable_drift
numberOptional tolerance for amount (percentage) or date (seconds).

Save the rule ID

Use response.data["rule_id"] in matching_rule_ids when you start reconciliation.

Response

{
  "rule_id": "rule_890bdbc4-467f-4670-8424-5667e41daf29",
  "name": "Amount match",
  "description": "Match by amount with 1% drift",
  "criteria": [
    {
      "field": "amount",
      "operator": "equals",
      "allowable_drift": 0.01
    }
  ],
  "created_at": "2024-11-26T08:36:36.238244338Z",
  "updated_at": "2024-11-26T08:36:36.238244338Z"
}
FieldTypeDescription
rule_idstrUnique ID for the rule. Store it to apply during reconciliation runs.
namestrRule name you passed.
criterialist[dict]The match criteria stored for the rule.
created_atstrWhen the rule was created.
updated_atstrWhen the rule was last updated.