Skip to main content
POST
/
expenses
/
check-duplicate
Pre-check for duplicate expense
curl --request POST \
  --url https://api.contazen.ro/v1/expenses/check-duplicate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "supplier_id": "<string>",
  "supplier_data": {
    "name": "<string>",
    "cui": "<string>"
  },
  "reference": "<string>",
  "date": "2023-12-25",
  "amount": 123,
  "currency": "RON"
}
'
{
  "duplicate": {
    "id": "<string>",
    "reference": "<string>",
    "date": "2023-12-25",
    "amount": 123,
    "currency": "<string>",
    "match_type": "exact"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.contazen.ro/llms.txt

Use this file to discover all available pages before exploring further.

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.
supplier_id
string
CzUid of the matched supplier. Preferred when known.
supplier_data
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
reference
string
Document number (factura, chitanță, bon fiscal). Used for both exact and likely cross-supplier matches.
date
string
Issue date in YYYY-MM-DD. Combined with supplier + amount for strong matches.
amount
number
Net amount (subtotal). Compared with ±0.02 tolerance to forgive rounding.
currency
string
default:"RON"
Three-letter ISO code. Defaults to RON.

Match types

match_typeTrigger
exactSame supplier + same reference
strongSame supplier + same date + amount within ±0.02
likelySame 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.
{
  "data": {
    "duplicate": {
      "id":         "Q9hjAB",
      "reference":  "65776",
      "date":       "2026-04-25",
      "amount":     147.53,
      "currency":   "RON",
      "match_type": "exact"
    }
  }
}

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