oneapi
Sign in
Anaf v1 / Declarații D

Build a batch

Several months of the same form in a single call, each with its own XML and verdict. For catch-ups and for rebuilding a whole history.

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

Path parameters

NameTypeDescriptionExample
formrequired string Code of the form the batch is built for (D112, D300…).

Request body

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

NameTypeDescriptionAccepted values
declaratiirequired object[] The declarations to build, at most 200, all of the same form. Each item takes the shape {form}/build accepts.
Two months of D394 Request body
{
    "declaratii": [
        {
            "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"
            }
        },
        {
            "luna": 10,
            "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": 2,
                    "baza": 1700,
                    "tva": 357
                }
            ],
            "reprezentant": {
                "den": "Exemplu Reprezentant",
                "functie": "Administrator",
                "adresa": "Cluj-Napoca, Str. Memorandumului 28"
            },
            "intocmit": {
                "den": "Exemplu Contabil",
                "cif": "990000005"
            }
        }
    ]
}
Two months of D100 Request body
{
    "declaratii": [
        {
            "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
                }
            ]
        },
        {
            "luna": 10,
            "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-11-25",
                    "nr_evid": "2",
                    "suma_dat": 1500,
                    "suma_plata": 1500
                }
            ]
        }
    ]
}
Two months of D390 Request body
{
    "declaratii": [
        {
            "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
                }
            ]
        },
        {
            "luna": 10,
            "an": 2026,
            "declarant": {
                "cui": "990000005",
                "den": "Exemplu Furnizor SRL",
                "nume": "Exemplu",
                "prenume": "Ion",
                "functie": "Administrator",
                "adresa": "Cluj-Napoca, Str. Memorandumului 28"
            },
            "operatiuni": [
                {
                    "tip": "A",
                    "tara": "HU",
                    "cod": "12345676",
                    "denumire": "Exemplu Furnizor Kft",
                    "baza": 8000
                }
            ]
        }
    ]
}

Query parameters

NameTypeDescriptionAccepted values
formatoptional text The XML form per item: xml (default) or base64. e.g. base64
strictoptional boolean true omits the XML on invalid items (you get only the errors); by default the XML is returned anyway. e.g. false

How it behaves

  • Builds several declarations of the SAME form ({form}, e.g. D390) in a single call. The body is JSON: {declaratii:[{...}, ...]}, each item in the shape {form}/build accepts. Each is generated (JSON→XML) and validated against the official XSD.
  • A broken declaration does not break the batch: invalid input or a build error is isolated per item and reported, the rest build normally.
  • A cap of 200 declarations per call. format=base64 returns the XML base64-encoded; strict=true omits the XML on invalid items (you get only their errors).
  • Zero retention and no SPV filing — we deliver ready-to-file XMLs; filing is done by the taxpayer.

What it is for

  • Bulk-generating XMLs (e.g. one D390 per company in a group), in a single request.

Response structure

FieldTypeDescription
data.formular string The built form code.
data.rezultate[] array One result per declaration, in the order submitted.
data.rezultate[].index integer The item index in the list.
data.rezultate[].valid boolean The XSD verdict: true/false, or null when validation could not run.
data.rezultate[].xml string The generated XML (text or base64); absent on invalid items when strict=true.
data.rezultate[].errors array The build/validation errors {cod,mesaj,camp}.
data.rezultate[].warnings array The non-blocking warnings {cod,mesaj,camp}.
data.sumar object Batch aggregate: total, valide, invalide.
data.sumar.total integer
data.sumar.valide integer
data.sumar.invalide integer
meta.generat_la string When the response was built (ISO 8601).

Response examples

body: {"declaratii": [{"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"}}, {"luna": 10, "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": 2, "baza": 1700, "tva": 357}], "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/build-lot/D394
{
    "data": {
        "formular": "D394",
        "rezultate": [
            {
                "index": 0,
                "valid": true,
                "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",
                "errors": [],
                "warnings": []
            }
        ],
        "sumar": {
            "total": 2,
            "valide": 2,
            "invalide": 0
        }
    },
    "meta": {
        "generat_la": "2026-10-06T23: 59: 42+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_invalidBody without declaratii (or empty), or over 200 declarations.
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": "Body without declaratii (or empty), or over 200 declarations.",
        "camp": "form",
        "request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
    }
}