oneapi
Sign in
Anaf v1 / Declarații D

Build the declaration

You send the business data as JSON and get the form's XML back, validated against the official schema before it is handed to you. If it does not pass, you get the schema errors instead of a file ANAF would reject.

POST
https://oneapi.ro/api/anaf/v1/declaratii/{form}/build

Path parameters

NameTypeDescriptionExample
formrequired string Form code (D100, D112, D300, D394…). The full list is at /anaf/v1/declaratii/forms.

Request body

Sent as JSON in the request body (Content-Type: application/json) — not in the query string.

D394 from JSON Request body
{
    "luna": 9,
    "an": 2026,
    "tip_D394": "L",
    "declarant": {
        "cui": "990000005",
        "caen": "6201",
        "telefon": "0264000000",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28",
        "den": "Exemplu Furnizor SRL"
    },
    "parteneri": [
        {
            "tip": "L",
            "tip_partener": 1,
            "cota": 21,
            "cui": "990000072",
            "den": "Exemplu Client SRL",
            "nr_facturi": 1,
            "baza": 700,
            "tva": 147
        }
    ],
    "reprezentant": {
        "den": "Exemplu Reprezentant",
        "functie": "Administrator",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28"
    },
    "intocmit": {
        "den": "Exemplu Contabil",
        "cif": "990000005"
    }
}
D300 from JSON Request body
{
    "luna": 9,
    "an": 2026,
    "tip_decont": "L",
    "declarant": {
        "cui": "990000005",
        "den": "Exemplu Furnizor SRL",
        "nume": "Exemplu",
        "prenume": "Ion",
        "functie": "Administrator",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28",
        "banca": "Banca Exemplu",
        "cont": "RO49AAAA1B31007593840000",
        "caen": "6201"
    },
    "randuri": {
        "R9_1": 1700,
        "R9_2": 357,
        "R64_1": 357
    }
}
D100 — state budget liabilities Request body
{
    "luna": 9,
    "an": 2026,
    "declarant": {
        "cui": "990000005",
        "den": "Exemplu Furnizor SRL",
        "nume": "Exemplu",
        "prenume": "Ion",
        "functie": "Administrator",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28"
    },
    "obligatii": [
        {
            "cod_oblig": "102",
            "cod_bugetar": "20100101",
            "scadenta": "2026-10-25",
            "nr_evid": "1",
            "suma_dat": 1200,
            "suma_plata": 1200
        }
    ]
}
D390 — VIES recapitulative Request body
{
    "luna": 9,
    "an": 2026,
    "declarant": {
        "cui": "990000005",
        "den": "Exemplu Furnizor SRL",
        "nume": "Exemplu",
        "prenume": "Ion",
        "functie": "Administrator",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28"
    },
    "operatiuni": [
        {
            "tip": "L",
            "tara": "DE",
            "cod": "999000009",
            "denumire": "Exemplu Client GmbH",
            "baza": 15000
        }
    ]
}
D311 — VAT owed by non-registered persons Request body
{
    "luna": 9,
    "an": 2026,
    "temei": "1",
    "total_plata": 850,
    "declarant": {
        "cui": "990000005",
        "den": "Exemplu Furnizor SRL",
        "nume": "Exemplu",
        "prenume": "Ion",
        "functie": "Administrator",
        "adresa": "Cluj-Napoca, Str. Memorandumului 28"
    }
}

Query parameters

NameTypeDescriptionAccepted values
validateoptional string The validation applied: local (default, official XSD) or none. e.g. locale.g. anafe.g. none
strictoptional boolean true (default) returns 422 without XML if validation fails; false returns the XML anyway. e.g. false
formatoptional text The shape of the XML: xml (default) or base64. e.g. base64

How it behaves

  • Takes a business JSON and returns the fiscal declaration as XML in the official ANAF format of the form in the path ({form}, e.g. D390). Totals are computed automatically from the lines.
  • The supported forms are listed at GET /anaf/v1/declaratii/forms — there are 13: D100, D101, D112, D205, D212, D230, D300, D301, D311, D390, D394, D700, D710. Each form's fields (from the official XSD) are listed at GET /anaf/v1/declaratii/{form}/campuri.
  • An unknown body field is rejected, not ignored. Send emaill instead of mail and you get 422 camp_necunoscut with the list accepted at that level — otherwise you would have got a valid but incomplete declaration, with no way to tell why.
  • validate selects the validation: local (default) runs the official XSD of the form; none only generates.
  • Zero retention and no SPV submission — we deliver the XML ready to file; the filing is done by the taxpayer.

What it is for

  • Generating the D390 XML from the record of intra-community operations, before filing.

Response structure

FieldTypeDescription
data.valid boolean The validation result; null when validate=none.
data.formular string The code of the generated form.
data.schema string
data.xml string The generated XML (text or base64).
data.meta object Metadata (namespace, computed totals).
data.meta.namespace string
data.meta.op_efectuate integer
data.meta.nr_parteneri integer
data.meta.nr_rezumat1 integer
data.meta.nr_rezumat2 integer
data.meta.total_plata_A integer
data.errors array Validation errors, when strict=false (with strict=true they come in the error envelope).
data.warnings array Non-blocking warnings.
meta.generat_la string When the response was built (ISO 8601).

Response examples

body: {"luna": 9, "an": 2026, "tip_D394": "L", "declarant": {"cui": "990000005", "caen": "6201", "telefon": "0264000000", "adresa": "Cluj-Napoca, Str. Memorandumului 28", "den": "Exemplu Furnizor SRL"}, "parteneri": [{"tip": "L", "tip_partener": 1, "cota": 21, "cui": "990000072", "den": "Exemplu Client SRL", "nr_facturi": 1, "baza": 700, "tva": 147}], "reprezentant": {"den": "Exemplu Reprezentant", "functie": "Administrator", "adresa": "Cluj-Napoca, Str. Memorandumului 28"}, "intocmit": {"den": "Exemplu Contabil", "cif": "990000005"}}

POSThttps://oneapi.ro/api/anaf/v1/declaratii/D394/build
{
    "data": {
        "valid": true,
        "formular": "D394",
        "schema": "d394_v5.xsd",
        "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<declaratie394 xmlns=\"mfp:anaf:dgti:d394:declaratie:v5\" luna=\"9\" an=\"2026\" tip_D394=\"L\" sistemTVA=\"0\" op_efectuate=\"1\" cui=\"990000005\" caen=\"6201\" den=\"Exemplu Furnizor SRL\" adresa=\"Cluj-Napoca, Str. Memorandumului 28\" telefon=\"0264000000\" totalPlata_A=\"701\" denR=\"Exemplu Reprezentant\" functie_reprez=\"Administrator\" adresaR=\"Cluj-Napoca, Str. Memorandumului 28\" tip_intocmit=\"0\" den_intocmit=\"Exemplu Contabil\" cif_intocmit=\"990000005\" calitate_intocmit=\"administrator\" optiune=\"0\" prsAfiliat=\"0\">\n  <informatii nrCui1=\"1\" nrCui2=\"0\" nrCui3=\"0\" nrCui4=\"0\" nr_BF_i1=\"0\" incasari_i1=\"0\" incasari_i2=\"0\" nrFacturi_terti=\"0\" nrFacturi_benef=\"0\" nrFacturi=\"1\" nrFacturiL_PF=\"0\" nrFacturiLS_PF=\"0\" val_LS_PF=\"0\" tvaDedAI24=\"0\" tvaDedAI21=\"0\" tvaDedAI11=\"0\" tvaDedAI20=\"0\" tvaDedAI19=\"0\" tvaDedAI9=\"0\" tvaDedAI5=\"0\" solicit=\"0\"/>\n  <rezumat1 tip_partener=\"1\" cota=\"21\" facturiL=\"1\" bazaL=\"700\" tvaL=\"147\"/>\n  <rezumat2 cota=\"21\" bazaFSLcod=\"0\" TVAFSLcod=\"0\" bazaFSL=\"0\" TVAFSL=\"0\" bazaFSA=\"0\" TVAFSA=\"0\" bazaFSAI=\"0\" TVAFSAI=\"0\" bazaBFAI=\"0\" TVABFAI=\"0\" nrFacturiL=\"1\" bazaL=\"700\" tvaL=\"147\" nrFacturiA=\"0\" bazaA=\"0\" tvaA=\"0\" nrFacturiAI=\"0\" bazaAI=\"0\" tvaAI=\"0\" bazaL_PF=\"0\" tvaL_PF=\"0\"/>\n  <op1 tip=\"L\" tip_partener=\"1\" cota=\"21\" cuiP=\"990000072\" denP=\"Exemplu Client SRL\" nrFact=\"1\" baza=\"700\" tva=\"147\"/>\n</declaratie394>\n",
        "meta": {
            "namespace": "mfp:anaf:dgti:d394:declaratie:v5",
            "op_efectuate": 1,
            "nr_parteneri": 1,
            "nr_rezumat1": 1,
            "nr_rezumat2": 1,
            "total_plata_A": 701
        },
        "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_invalidInvalid JSON or — when strict=true — a declaration that fails validation.
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": "Invalid JSON or — when strict=true — a declaration that fails validation.",
        "camp": "form",
        "request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
    }
}