Skip to content

Reconciliation Rules (قواعد المطابقة)

Reconciliation rules define auto-matching patterns for bank reconciliation. Each rule pairs a description pattern (regex or keyword) with a GL account. When importing bank statement lines, the system checks each transaction description against the active rules and automatically suggests or applies the matching account, reducing manual reconciliation effort.

Purpose

  • Define reusable patterns to auto-match bank statement transactions to GL accounts
  • Reduce manual reconciliation by pre-mapping common transaction descriptions
  • Support pattern-based matching (e.g., "ATM*", "SALARY*", "TRANSFER*")
  • Enable activation/deactivation of rules without deletion

Entity Attributes

FieldTypeRequiredDescription
idintegerautoPrimary key
company_idintegerautoOwning company
namestringyesRule name (English)
name_arstringnoRule name (Arabic)
description_patternstringyesPattern to match against transaction descriptions
account_idFKyesGL account to assign when matched
is_activebooleannoActive status (default: true)
created_atdatetimeautoCreation timestamp
updated_atdatetimeautoLast update timestamp

Relationships

API Endpoints

MethodPathDescriptionPermission
GET/api/accounting/reconciliation-rulesList rules (paginated)accounting.reconciliation-rules.view
POST/api/accounting/reconciliation-rulesCreate a ruleaccounting.reconciliation-rules.create
GET/api/accounting/reconciliation-rules/{id}Get a ruleaccounting.reconciliation-rules.view
PUT/api/accounting/reconciliation-rules/{id}Update a ruleaccounting.reconciliation-rules.update
DELETE/api/accounting/reconciliation-rules/{id}Soft-delete a ruleaccounting.reconciliation-rules.delete

Request/Response Examples

Create Reconciliation Rule

bash
curl -X POST /api/accounting/reconciliation-rules \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ATM Withdrawals",
    "name_ar": "سحب صراف آلي",
    "description_pattern": "ATM*WITHDRAWAL",
    "account_id": 10,
    "is_active": true
  }'
dart
final response = await dio.post('/api/accounting/reconciliation-rules', data: {
  'name': 'ATM Withdrawals',
  'name_ar': 'سحب صراف آلي',
  'description_pattern': 'ATM*WITHDRAWAL',
  'account_id': 10,
  'is_active': true,
});

Response 201 Created

json
{
  "data": {
    "id": 1,
    "company_id": 1,
    "name": "ATM Withdrawals",
    "name_en": "ATM Withdrawals",
    "name_ar": "سحب صراف آلي",
    "description_pattern": "ATM*WITHDRAWAL",
    "account_id": 10,
    "account": {
      "id": 10,
      "code": "1001",
      "name": "Cash on Hand"
    },
    "is_active": true,
    "created_at": "2026-03-10T08:00:00.000000Z",
    "updated_at": "2026-03-10T08:00:00.000000Z"
  }
}

Update Reconciliation Rule

bash
curl -X PUT /api/accounting/reconciliation-rules/1 \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "description_pattern": "ATM*",
    "is_active": true
  }'
dart
final response = await dio.put('/api/accounting/reconciliation-rules/1', data: {
  'description_pattern': 'ATM*',
  'is_active': true,
});

List Rules

bash
curl -X GET /api/accounting/reconciliation-rules \
  -H "Authorization: Bearer {token}"
dart
final response = await dio.get('/api/accounting/reconciliation-rules');

Business Rules

  1. Pattern matching -- the description_pattern field holds a pattern (wildcard or keyword) used to match against bank statement transaction descriptions during reconciliation.
  2. Account mapping -- when a bank transaction description matches a rule's pattern, the rule's account_id is suggested as the counterpart GL account.
  3. Active scope -- only rules with is_active: true are used during auto-matching. The scopeActive query helper filters accordingly.
  4. Ordered by name -- the list endpoint returns rules ordered alphabetically by name.
  5. Account included -- the response always includes the related account details (id, code, name).
  6. Soft delete -- deleting a rule performs a soft delete, preserving audit history.
  7. Company scoped -- all queries filter by the authenticated user's company.
  8. No duplicate enforcement -- multiple rules can map to the same account. The first matching rule wins during reconciliation.

Moon ERP API Documentation