oneapi
Sign in
Anaf v1 / Utilitare cross-zonă

Validate any document

You send an XML without saying what it is: the route detects the type itself and applies the validation that fits. The same verdict you would get from the product's own route.

POST
https://oneapi.ro/api/anaf/v1/valideaza

Request body

The request body is the whole document, sent raw (Content-Type: application/xml) — not an object with fields.

An e-invoice

efactura.xml application/xml · 4,0 KB — sent as is, in the request body.

A D394 return

d394.xml application/xml · 1,3 KB — sent as is, in the request body.

An e-Transport notification

etransport.xml application/xml · 1,1 KB — sent as is, in the request body.

A SAF-T D406 return

saft-d406.xml application/xml · 17,5 KB — sent as is, in the request body.

A credit note

efactura-stornare.xml application/xml · 3,6 KB — sent as is, in the request body.

Query parameters

This route accepts no query parameters.

How it behaves

  • The document can also be sent as a file: multipart/form-data with the fisier field (curl -F fisier=@document.xml), instead of the raw body. The file content becomes the request body, so the result is identical; options stay in the query string, and any other form field next to fisier returns 422 camp_necunoscut.
  • Takes ONE ANAF document (raw XML or base64, in the request body), auto-detects its type and routes it to the right product validator — e-Invoice, e-Transport, SAF-T or a "D" declaration. The "validate whatever this is" call: you do not need to know the type up front.
  • The difference from the per-product validate routes (efactura/v1/validate, declaratii/v1/{form}/validate…): here you do not pick the validator — the detector picks it, from root + namespace.
  • An invalid XML or unrecognized document is not a server error: the response is 404 with document_nerecunoscut (the common error format).
  • Zero retention: the document received is not written and not logged.

What it is for

  • Validating an incoming file without knowing its type in advance, in a single call.
  • A generic webhook/uploader that accepts any ANAF document and checks it on the spot.

Response structure

FieldTypeDescription
data.tip string The detected type: e-Factura, e-Transport, SAF-T (D406) or the "D" form code (e.g. D390).
data.produs string The umbrella product that validated it: efactura, etransport, saft or declaratii.
data.valid boolean The verdict: true/false, or null when validation could not run (e.g. schema unavailable).
data.schema_version string The schema/standard used for validation, when available (e.g. FACT1 or d390_v3.xsd); otherwise null.
data.errors array The validation errors {cod,mesaj,camp}.
data.warnings array The non-blocking warnings {cod,mesaj,camp}.
meta.generat_la string When the response was built (ISO 8601).
meta.request_id string The identifier of this request. Quote it when reporting a problem — it is what the answer is found by.

Response examples

body: @efactura.xml

POSThttps://oneapi.ro/api/anaf/v1/valideaza
{
    "data": {
        "tip": "e-Factura",
        "produs": "efactura",
        "valid": true,
        "schema_version": "FACT1",
        "errors": [],
        "warnings": []
    },
    "meta": {
        "generat_la": "2026-10-06T23: 59: 41+03: 00",
        "request_id": "01a11303-d835-714f-acc5-2b4923e048f1"
    }
}

Error codes

CodeSlugWhen it occurs
401neautentificatToken missing, invalid, expired or revoked.
403feature_indisponibilThe current plan does not include the feature the route depends on.
404negasitInvalid XML or unrecognized ANAF document (unknown root/namespace).
422xml_invalidThe request body is missing or does not have the expected shape.
429cota_depasitaThe plan's monthly quota has been exceeded (see Retry-After).

Errors in the Anaf module use the same envelope as the rest of the platform, with two extra fields: {eroare: {cod, mesaj, camp, request_id}}. eroare.cod is stable and is what you branch on; on validation (422) the code is case-specific: xml_invalid, xml_nu_e_factura, unitate_necunoscuta, luna_invalida and so on. camp points at the offending field when one can be identified.

{
    "eroare": {
        "cod": "xml_invalid",
        "mesaj": "The request body is missing or does not have the expected shape.",
        "camp": null,
        "request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
    }
}