This integration is optional. Matcher is a stand-alone product that works independently. Use this guide only if you want to integrate Matcher with Midaz Ledger.
Overview
The Midaz integration provides:
- Direct ledger access: Query transactions directly from Midaz without file exports
- Real-time sync: Automatic transaction synchronization as entries are posted
- Unified authentication: Single auth system via lib-auth
- Tenant isolation: Schema-per-tenant architecture ensures data separation
Prerequisites
Before configuring the Midaz integration:
- Midaz Ledger instance running and accessible
- API credentials with transaction read permissions
- Network connectivity between Matcher and Midaz
- Matching tenant configuration in both systems
Configuration
Environment variables
Configure Matcher to connect to your Midaz instance:Create Midaz source via API
cURL
Response
Source settings
| Setting | Type | Description |
|---|---|---|
ledger_id | String | Target ledger ID in Midaz |
account_filter.type | String | Account type filter (ASSET, LIABILITY, etc.) |
account_filter.path_prefix | String | Account path prefix to include |
account_filter.accounts | Array | Specific account IDs to include |
sync_mode | String | realtime or batch |
lookback_days | Integer | Days of historical data to include |
exclude_pending | Boolean | Exclude pending entries |
Authentication
Matcher uses the same authentication system as Midaz via the shared
lib-auth library.
Service-to-service auth
Matcher authenticates to Midaz using OAuth 2.0 client credentials:Required scopes
| Scope | Permission |
|---|---|
ledger:read | Read ledger metadata |
transactions:read | Read transaction entries |
accounts:read | Read account information |
Tenant context
All requests include the tenant context header:Querying transactions
Automatic sync
Withsync_mode: realtime, Matcher subscribes to Midaz events and receives transactions as they’re posted. When a transaction is created in Midaz, it publishes an event to the message queue. Matcher consumes the event, stores the transaction locally, and queues it for matching—all without manual intervention.

Manual query
For batch operations or historical data:cURL
Response
Query filters
Filter transactions when syncing:Transaction mapping
Midaz transactions are automatically mapped to Matcher’s schema:
| Midaz Field | Matcher Field | Notes |
|---|---|---|
id | transaction_id | Unique entry ID |
amount | amount | Decimal amount |
asset_code | currency | ISO currency code |
created_at | date | Entry date |
description | reference | Entry description |
metadata.external_ref | external_id | External reference if present |
operation | type | CREDIT or DEBIT |
Custom field mapping
Override default mapping for specific use cases:Tenant isolation
Matcher inherits Midaz’s schema-per-tenant isolation model.
How it works
- Each tenant has a dedicated PostgreSQL schema
- All queries are scoped to the tenant’s schema
- Connection pooling maintains schema context
- No cross-tenant data access is possible
Tenant resolution
Tenant is determined from the authentication token:Error handling
Connection errors
Authentication errors
Sync errors
Monitoring
Connection health
Response
Sync statistics
Best practices
Use realtime sync for active reconciliation
Use realtime sync for active reconciliation
Enable
sync_mode: realtime for contexts with daily reconciliation. This ensures transactions are available for matching immediately after posting.Filter by account path
Filter by account path
Use
account_filter.path_prefix to limit transactions to relevant accounts. This reduces data volume and improves matching performance.Set appropriate lookback period
Set appropriate lookback period
Configure
lookback_days based on your reconciliation cycle. Daily reconciliation typically needs 7-14 days; monthly needs 45-60 days.Monitor sync lag
Monitor sync lag
Track the delay between Midaz posts and Matcher availability. High lag may indicate queue backup or processing issues.
Use metadata for matching
Use metadata for matching
Store matching-relevant data in Midaz metadata fields (invoice numbers, bank references) and map them to Matcher fields for better match rates.

