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.
Request body
The request body is the whole document, sent raw (Content-Type: application/xml) — not an object with fields.
Query parameters
How it behaves
- The document can also be sent as a file:
multipart/form-datawith thefisierfield (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 tofisierreturns422 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
404withdocument_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
e-Factura, e-Transport, SAF-T (D406) or the "D" form code (e.g. D390).
efactura, etransport, saft or declaratii.
true/false, or null when validation could not run (e.g. schema unavailable).
FACT1 or d390_v3.xsd); otherwise null.
{cod,mesaj,camp}.
{cod,mesaj,camp}.
Response examples
body: @efactura.xml
{
"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"
}
}
body: @d394.xml
{
"data": {
"tip": "D394",
"produs": "declaratii",
"valid": true,
"schema_version": "d394_v5.xsd",
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d847-7282-b38c-67a70761e997"
}
}
body: @etransport.xml
{
"data": {
"tip": "e-Transport",
"produs": "etransport",
"valid": true,
"schema_version": null,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d851-72b2-aa5d-cba6e2f8cfd3"
}
}
body: @saft-d406.xml
{
"data": {
"tip": "SAF-T (D406)",
"produs": "saft",
"valid": true,
"schema_version": null,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d85d-73df-b664-ff434090510b"
}
}
body: @efactura-stornare.xml
{
"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-d86c-72c9-a97d-778062d35e1f"
}
}
Error codes
| Code | Slug | When it occurs |
|---|---|---|
| 401 | neautentificat | Token missing, invalid, expired or revoked. |
| 403 | feature_indisponibil | The current plan does not include the feature the route depends on. |
| 404 | negasit | Invalid XML or unrecognized ANAF document (unknown root/namespace). |
| 422 | xml_invalid | The request body is missing or does not have the expected shape. |
| 429 | cota_depasita | The 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"
}
}