Detect document
Tells you which ANAF document you sent, without validating it: the type, the product it belongs to, the root element and the namespace. Useful when you receive XML from third parties and do not know which route to send it to.
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 an arbitrary XML in the request body and tells you which ANAF document it is, based on the root element and namespace: e-Invoice (
Invoice/CreditNoteUBL), e-Transport, SAF-T / D406 or a "D" declaration (mapped to the form code, e.g.D390). - Handy as a first step in a flow that receives heterogeneous files: you learn the product and the right validation route (
ruta_validare) without guessing the type from the file name. - An invalid XML or unrecognized document is not a server error: the response is
404withdocument_nerecunoscut(the common error format). - Zero retention: the XML received is not written and not logged.
What it is for
- Automatically routing an incoming file to the correct product validator/parser.
- Quickly checking that a file is really the expected type before processing.
Response structure
e-Factura, e-Transport, SAF-T (D406) or the "D" form code (e.g. D390).
efactura, etransport, saft or declaratii.
null).
/anaf/v1/efactura/validate), ready to call on the same host. null for a recognised declaration we do not validate.
Response examples
body: @efactura.xml
{
"data": {
"tip": "e-Factura",
"produs": "efactura",
"root": "Invoice",
"namespace": "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
"ruta_validare": "/anaf/v1/efactura/validate"
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d7bb-726f-9bf0-4d8d26b22abf"
}
}
body: @d394.xml
{
"data": {
"tip": "D394",
"produs": "declaratii",
"root": "declaratie394",
"namespace": "mfp:anaf:dgti:d394:declaratie:v5",
"ruta_validare": "/anaf/v1/declaratii/D394/validate"
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d7ca-70a2-9f5a-08e8a0b0fc92"
}
}
body: @saft-d406.xml
{
"data": {
"tip": "SAF-T (D406)",
"produs": "saft",
"root": "AuditFile",
"namespace": "mfp:anaf:dgti:d406t:declaratie:v1",
"ruta_validare": "/anaf/v1/saft/validate"
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00",
"request_id": "01a11303-d7ce-7211-af3d-615141729a0a"
}
}
Error codes
| Code | Slug | When it occurs |
|---|---|---|
| 401 | neautentificat | Token missing, invalid, expired or revoked. |
| 403 | modul_interzis | The token has no access to the route's module. |
| 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"
}
}