Skip to main content
POST
Pre-check for duplicate expense

When to use

Call this before POST /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 either supplier_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.
string
CzUid of the matched supplier. Preferred when known.
object
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 document
  • cui — supplier CUI / VAT number, with or without RO prefix
string
Document number (factura, chitanță, bon fiscal). Used for both exact and likely cross-supplier matches.
string
Issue date in YYYY-MM-DD. Combined with supplier + amount for strong matches.
number
Net amount (subtotal). Compared with ±0.02 tolerance to forgive rounding.
string
default:"RON"
Three-letter ISO code. Defaults to RON.

Match types

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_id nor supplier_data.name is provided
  • 401 — missing / invalid bearer token
  • 403 — API key lacks read permission on expenses

Authorizations

Authorization
string
header
required

Use your API key (sk_live_xxx or sk_test_xxx)

Body

application/json
supplier_id
string

Supplier CzUid (preferred) or omit and send supplier_data.

supplier_data
object
reference
string
date
string<date>
amount
number
currency
string
default:RON

Response

200 - application/json

Duplicate check result

duplicate
object | null