oneapi
Sign in
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

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

D300

etva-propriu.xml application/xml · 0,5 KB — sent as is, in the request body.

D390

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

D311

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

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-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 the XML of a "D" declaration and validates it against the official XSD of the form in the path. An invalid XML returns 200 with valid:false and 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"
    }
}

Error codes

CodeSlugWhen it occurs
401neautentificatToken missing, invalid, expired or revoked.
403feature_indisponibilThe current plan does not include the feature the route depends on.
404negasitUnsupported form.
422xml_invalidA field failed validation (anaf); detalii says which and why.
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": "A field failed validation (anaf); detalii says which and why.",
        "camp": "form",
        "request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
    }
}