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
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | auto | Primary key |
company_id | integer | auto | Owning company |
name | string | yes | Rule name (English) |
name_ar | string | no | Rule name (Arabic) |
description_pattern | string | yes | Pattern to match against transaction descriptions |
account_id | FK | yes | GL account to assign when matched |
is_active | boolean | no | Active status (default: true) |
created_at | datetime | auto | Creation timestamp |
updated_at | datetime | auto | Last update timestamp |
Relationships
API Endpoints
| Method | Path | Description | Permission |
|---|---|---|---|
GET | /api/accounting/reconciliation-rules | List rules (paginated) | accounting.reconciliation-rules.view |
POST | /api/accounting/reconciliation-rules | Create a rule | accounting.reconciliation-rules.create |
GET | /api/accounting/reconciliation-rules/{id} | Get a rule | accounting.reconciliation-rules.view |
PUT | /api/accounting/reconciliation-rules/{id} | Update a rule | accounting.reconciliation-rules.update |
DELETE | /api/accounting/reconciliation-rules/{id} | Soft-delete a rule | accounting.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
- Pattern matching -- the
description_patternfield holds a pattern (wildcard or keyword) used to match against bank statement transaction descriptions during reconciliation. - Account mapping -- when a bank transaction description matches a rule's pattern, the rule's
account_idis suggested as the counterpart GL account. - Active scope -- only rules with
is_active: trueare used during auto-matching. ThescopeActivequery helper filters accordingly. - Ordered by name -- the list endpoint returns rules ordered alphabetically by name.
- Account included -- the response always includes the related account details (id, code, name).
- Soft delete -- deleting a rule performs a soft delete, preserving audit history.
- Company scoped -- all queries filter by the authenticated user's company.
- No duplicate enforcement -- multiple rules can map to the same account. The first matching rule wins during reconciliation.