Pre-check for duplicate expense
Expenses
Check for duplicate expense
Probe the firm’s books for an existing expense that would collide with a prospective payload. Useful before posting a scanned receipt.
POST
Pre-check for duplicate expense
When to use
Call this beforePOST /expenses when the source is unattended (OCR, recurring import, supplier sync). The response tells the UI whether to surface a confirmation dialog (“an expense from this supplier with this reference already exists — continue?”) instead of silently posting a duplicate.
The endpoint never modifies state. Match resolution mirrors the server-side detector used by the OCR + import flows.
Request
Send eithersupplier_id (preferred — Romanian companies often share name prefixes) or supplier_data with the resolved name/CUI from the receipt. The endpoint never auto-creates a supplier; if the supplier_data block doesn’t match an existing row, the supplier match is treated as missing and only reference-based matches are considered.
CzUid of the matched supplier. Preferred when known.
Fallback when
supplier_id is unknown. Resolved by CUI first (with RO prefix stripped), then by exact name match.name— supplier name as printed on the documentcui— supplier CUI / VAT number, with or withoutROprefix
Document number (factura, chitanță, bon fiscal). Used for both exact and
likely cross-supplier matches.Issue date in
YYYY-MM-DD. Combined with supplier + amount for strong matches.Net amount (subtotal). Compared with ±0.02 tolerance to forgive rounding.
Three-letter ISO code. Defaults to
RON.Match types
match_type | Trigger |
|---|---|
exact | Same supplier + same reference |
strong | Same supplier + same date + amount within ±0.02 |
likely | Same reference under a different supplier (review before posting) |
exact and strong should usually block; likely deserves a confirmation but isn’t necessarily a true duplicate (e.g. invoice numbers reset per fiscal year across suppliers).
Response
duplicate is null when no candidate matches. When populated, the id is the CzUid of the existing expense — fetch it via GET /expenses/{id} for the full record.
Errors
- 400 — invalid JSON body or missing required fields when neither
supplier_idnorsupplier_data.nameis provided - 401 — missing / invalid bearer token
- 403 — API key lacks
readpermission on expenses
Authorizations
Use your API key (sk_live_xxx or sk_test_xxx)
Body
application/json
Response
200 - application/json
Duplicate check result