Anaf v1 / Declarații D
Validate the declaration
The official XSD's verdict on an already built return — yours or one you received. The errors come with the element and attribute they stopped at.
POST
https://oneapi.ro/api/anaf/v1/declaratii/{form}/validate
Path parameters
NameTypeDescriptionExample
formrequired
string
Form code (
D100, D112, D300, D394…). The full list is at /anaf/v1/declaratii/forms.
Request body
The request body is the whole document, sent raw (Content-Type: application/xml) — not an object with fields.
D394
D300
D390
D311
Query parameters
NameTypeDescriptionAccepted values
anafoptional
boolean
At
1, checks the fiscal status (VAT payer / inactive) of the RO partners in D394/D300 from local ANAF data; appears in data.anaf. Does not block validation.
e.g. 1
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 the XML of a "D" declaration and validates it against the official XSD of the form in the path. An invalid XML returns
200withvalid:falseand the errors. - Zero retention: the XML received is not written and not logged.
What it is for
- Checking a declaration generated elsewhere, before filing.
Response structure
FieldTypeDescription
data.valid
boolean
The XSD verdict.
data.formular
string
The form code.
data.schema
string
The XSD file used for validation.
data.namespace
string
The XML namespace of the form.
data.xsd_checked
boolean
Whether XSD validation ran.
data.errors
array
The validation errors
{cod,mesaj,camp}.
data.warnings
array
Non-blocking warnings.
meta.generat_la
string
When the response was built (ISO 8601).
data.anaf
Only with
?anaf=1 on D394/D300: the local fiscal status of the RO CUIs — a list {cui, gasit, platitor_tva, inactiv, denumire}.
Response examples
body: @d394.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D394/validate
{
"data": {
"valid": true,
"formular": "D394",
"schema": "d394_v5.xsd",
"namespace": "mfp:anaf:dgti:d394:declaratie:v5",
"xsd_checked": true,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00"
}
}
body: @etva-propriu.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D300/validate
{
"data": {
"valid": true,
"formular": "D300",
"schema": "d300_v12.xsd",
"namespace": "mfp:anaf:dgti:d300:declaratie:v12",
"xsd_checked": true,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00"
}
}
body: @d390.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D390/validate
{
"data": {
"valid": true,
"formular": "D390",
"schema": "d390_v3.xsd",
"namespace": "mfp:anaf:dgti:d390:declaratie:v3",
"xsd_checked": true,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00"
}
}
body: @d311.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D311/validate
{
"data": {
"valid": true,
"formular": "D311",
"schema": "d311_v1.xsd",
"namespace": "mfp:anaf:dgti:d311:declaratie:v1",
"xsd_checked": true,
"errors": [],
"warnings": []
},
"meta": {
"generat_la": "2026-10-06T23: 59: 41+03: 00"
}
}
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 | Unsupported form. |
| 422 | xml_invalid | A field failed validation (anaf); detalii says which and why. |
| 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": "A field failed validation (anaf); detalii says which and why.",
"camp": "form",
"request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
}
}