Skip to main content

Endpoint

POST /reconciliation/matching-rules
Creates a matching rule that defines how external transactions should be matched with internal Blnk transactions during reconciliation. Rules can specify criteria for matching based on amount, reference, date, and other fields.

Request Body

name
string
required
A descriptive name for the matching rule
description
string
A detailed description of what this rule matches and when to use it
criteria
array
required
Array of matching criteria that define how to match transactions

Response

rule_id
string
The unique identifier for the created matching rule
name
string
The name of the matching rule
description
string
The description of the matching rule
criteria
array
The array of matching criteria
created_at
string
Timestamp when the rule was created (ISO 8601 format)
updated_at
string
Timestamp when the rule was last updated

Example Request

Exact Amount and Reference Match

{
  "name": "Stripe Payment Match",
  "description": "Matches Stripe payments by exact amount and reference",
  "criteria": [
    {
      "field": "amount",
      "operator": "eq",
      "allowable_drift": 0.01
    },
    {
      "field": "reference",
      "operator": "eq"
    }
  ]
}

Date Range with Amount Matching

{
  "name": "Bank Statement Match",
  "description": "Matches bank statement entries within a 2-day window",
  "criteria": [
    {
      "field": "amount",
      "operator": "eq",
      "allowable_drift": 0.0
    },
    {
      "field": "date",
      "operator": "within_range",
      "value": "2d"
    }
  ]
}

Pattern Matching on Description

{
  "name": "Invoice Payment Match",
  "description": "Matches payments with invoice references in description",
  "criteria": [
    {
      "field": "description",
      "operator": "contains",
      "value": "INV-"
    },
    {
      "field": "amount",
      "operator": "eq",
      "allowable_drift": 0.0
    }
  ]
}

Example Response

{
  "rule_id": "rule_xyz789",
  "name": "Stripe Payment Match",
  "description": "Matches Stripe payments by exact amount and reference",
  "criteria": [
    {
      "field": "amount",
      "operator": "eq",
      "allowable_drift": 0.01
    },
    {
      "field": "reference",
      "operator": "eq"
    }
  ],
  "created_at": "2024-03-04T12:00:00Z",
  "updated_at": "2024-03-04T12:00:00Z"
}

Error Responses

error
string
Error message describing what went wrong

Common Errors

  • 400 Bad Request: Invalid request body or criteria
  • 500 Internal Server Error: Failed to create matching rule

Best Practices

  1. Start with strict rules: Begin with exact matches and gradually relax criteria if needed
  2. Use allowable drift carefully: For amounts, account for rounding differences or fees
  3. Combine multiple criteria: Use multiple matching criteria for more accurate matches
  4. Test with dry runs: Use the dry run option when starting reconciliation to validate rules

Build docs developers (and LLMs) love