Reconciliation

Create matching rule

Create a reconciliation matching rule with the TypeScript SDK.

POST/reconciliation/matching-rules

Use blnk.Reconciliation.createMatchingRule to create a matching rule.

Call the method

const response = await blnk.Reconciliation.createMatchingRule({
  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
namestringName of the matching rule.
descriptionstringShort description of what the rule does.
criteriaobject[]Array of match criteria. Each entry sets how one field is compared.
criteria[].fieldstringField to match: amount, currency, reference, description, or date.
criteria[].operatorstringHow to compare the field: equals or contains.
criteria[].allowable_driftnumberOptional 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_idstringUnique ID for the rule. Store it to apply during reconciliation runs.
namestringRule name you passed.
criteriaobject[]The match criteria stored for the rule.
created_atstringWhen the rule was created.
updated_atstringWhen the rule was last updated.