QFind anything/
API Reference

LedgerMatch Integration

LedgerMatch is the external service that powers matching. It takes an incoming transaction and expected candidates, returns ranked matches with confidence scores. Supports REST (single-transaction) and gRPC (bulk).

Role of LedgerMatch

LedgerMatch is the primary external dependency for reconciliation. Payment Reconciler sends it:

  • Input — One incoming transaction + expected transactions (candidates) for the same tenant and environment. Match requests include a non-negative amount and direction (DEBIT | CREDIT) so scoring aligns with accounting semantics.
  • Output — Ranked matches with confidence scores and per-field indicators

LedgerMatch does not store data; it performs the scoring and ranking. Payment Reconciler stores the resulting matches and lets you accept or reject them.

How LedgerMatch scores matches

Each match includes:

ScoreDescription
confidenceCombined score (0–1). Used for auto-accept threshold.
embeddingSimilaritySemantic similarity of merchant/description (embeddings).
amountScoreHow closely amounts align.
dateScoreProximity of transaction dates.
referenceMatchWhether reference IDs match (boolean).

LedgerMatch also returns matchedFields indicating which fields contributed (merchant, amount, date, description, reference). The explanation field provides a human-readable summary.

When LedgerMatch is called

TriggerWhenProtocol
Auto-matchNew incoming transaction created and autoMatchEnabled is trueREST
Manual matchPOST /matches/match with incomingTransactionIdREST
Scheduled matching jobBatch job processes PENDING incoming transactionsREST or gRPC

For scheduled jobs, the protocol depends on tenant settings and batch size. See REST vs gRPC below.

REST vs gRPC

StrategyWhen usedNotes
restDefault. Auto-match, manual trigger, single-transaction jobs.One REST call per incoming transaction.
grpcTenant has matchStrategy: 'grpc' and job processes 2+ transactions.Bulk gRPC stream; more efficient for large batches.

Configure via ledgerMatchPreferences.matchStrategy in Tenant Settings. When set to grpc, autoMatchEnabled is automatically disabled (auto-match uses REST only).

For gRPC bulk matching, autoAcceptForBulkMatch in LedgerMatch preferences controls whether top-ranked matches above threshold are auto-accepted during the batch run.

Retry and timeout

LedgerMatch calls can fail due to network or service issues. Configure in ledgerMatchPreferences:

  • retryAttempts — Number of retries (1–10)
  • retryDelaysMs — Comma-separated delays between retries (e.g. 1000,2000,4000)
  • timeoutMs — Request timeout (1000–60000 ms)

See LedgerMatch Preferences for details.

Health check

GET /health/ledger-match verifies LedgerMatch is reachable. Use this for monitoring and alerting. The response includes status and timestamp.

API Reference

For match endpoints and request/response structures, see Matches in the API Reference.