Prerequisites
- A reconciliation with data streams on Side A and Side B. See Reconciliations.
- Records on both sides, so you can see which fields they share.
- For the API, an API key for the environment and the reconciliation’s id (
GET /reconciliations).
How rules match records
- All conditions must hold. A one-to-one rule matches a pair only when its whole condition tree is true. Conditions are combined with AND, and you can nest an OR group.
- Rules run in priority order. Lower
priorityvalues run first. A record matched by one rule is no longer available to the rules after it, so put your strictest rules first. - Each record matches once. A record is in at most one match per reconciliation.
- Two exact conditions, one of them on amount. A one-to-one rule needs a condition on
amountand at least twoeqconditions without a tolerance. End Close refuses a rule that has fewer, because it would pair too many records.
When rules run
On a continuous reconciliation, End Close matches each record against your one-to-one rules as it arrives, and saving an active rule starts a run over the records already there. On a batch reconciliation, rules run when you choose Run in the app or callPOST /reconciliations/{id}/run. Rollup rules run separately; see Rollup rules.
Create a rule in the app
1
Open the reconciliation's rules
Go to Reconciliations, open the reconciliation and choose the Rules tab. A reconciliation with no rules offers Generate rules, which looks at your records and proposes rules for you to review.
2
Start a one-to-one rule
Choose New rule, then One-to-one.
3
Add match conditions
Under Match conditions, pick a Side A field, an operator and a Side B field for each condition. Add a tolerance to a condition when the values can differ slightly, for example a date that lands a day or two later on the bank side.
4
Describe and save
Give the rule an optional description, such as “Stripe charge to ledger entry by charge ID”, and save it.
5
Set the order
If the reconciliation has more than one rule, choose Reorder and drag the rules into the order they should run.
Create a rule with the API
Send the rule’s condition tree asfilters. In every condition, key names the Side A field and value names the Side B field to compare it with.
This rule matches a ledger entry (Side A) to a processor charge (Side B) when the amounts are equal, the ledger’s metadata.charge_id equals the charge’s external_id, and the dates are no more than two days apart:
cURL
"status": "active" and "source": "user". A rule that duplicates an existing active rule, or whose conditions are a subset of one, is refused with 422 and a message naming the rule it overlaps.
To change a rule, send only the fields you want to change to PATCH /reconciliation_rules/{id}. To list a reconciliation’s active rules in the order they run, call GET /reconciliation_rules?reconciliation_id=....
Rule reference
Fields you can compare
Operators
Tolerances
Tolerances apply toeq conditions. A condition with a tolerance doesn’t count toward the two exact conditions a rule needs.
Transforms
transforms normalizes values before they’re compared. Set key for the Side A field and value for the Side B field. Each takes one transform, or an array applied in order with the first innermost.
Different currencies
When two records are in different currencies, anamount eq amount condition without transforms compares them after converting both to USD at the rate on or before each record’s date. Records in the same currency are compared as they are.
FAQ
Why was my rule refused with a 422?
Why was my rule refused with a 422?
The message says which check failed. The usual causes are a one-to-one rule with no condition on
amount, fewer than two eq conditions without a tolerance, an unknown transform, or conditions that duplicate an existing active rule.Why didn't a pair match when the rule looks right?
Why didn't a pair match when the rule looks right?
Check whether an earlier rule already matched one of the records, since each record matches once and rules run in priority order. Then check the field values exactly: case, spaces and prefixes all count unless a transform removes them.
What are proposed rules?
What are proposed rules?
Rules that Generate rules suggests start as
proposed, with a confidence and a sample_match_rate from a dry run on your records. They don’t match anything until you accept them and they become active.Can I match records by hand instead?
Can I match records by hand instead?
Yes. Select the records in the reconciliation and choose Reconcile, or create the match with
POST /reconciliation_matches. See Rules and matches.Related
Rollup rules
Sum several records on one side against one record on the other.
Rules and matches
How rules, matches and adjustments fit together.
Review exceptions
Work through the records your rules leave unmatched.
Reconciliations
Sides, data streams and how a reconciliation runs.