Derive a draft from an existing source
Builds a DRAFT return from what you already hold: D394 and D390 from e-Factura invoices, D710 from two D100 returns (the original and the corrected one). The draft then goes to build, after you check it.
Path parameters
Request body
Sent as JSON in the request body (Content-Type: application/json) — not in the query string.
{form}/build accepts: cui, den, adresa, nume, prenume, functie, telefon, fax, mail (plus caen for D394). An unknown key — say denumire instead of den — returns 422 listing the accepted keys. Whatever stays empty shows up in warnings.
D390/D394: the batch of e-Factura (CIUS-RO) invoices to derive from. An item is either the XML itself (text or base64) or the object {id, xml}. Not sent for D710 — there the body is {initial, corectat}.
D390/D394: the reported month, 1–12. Not sent for D710.
D390/D394: the reported year, 2016 or later. Not sent for D710.
D710: the D100 as filed, raw XML or base64.
D710: the corrected D100, raw XML or base64.
{
"luna": 9,
"an": 2026,
"declarant": {
"cui": "990000005",
"den": "Exemplu Furnizor SRL"
},
"facturi": [
"@efactura.xml"
]
}
In this example, @efactura.xml stand in for whole documents: send the file content — XML as text or base64, a PDF as base64 — not its name.
{
"luna": 9,
"an": 2026,
"declarant": {
"cui": "990000005",
"den": "Exemplu Furnizor SRL"
},
"facturi": [
"@efactura-intracomunitara.xml"
]
}
In this example, @efactura-intracomunitara.xml stand in for whole documents: send the file content — XML as text or base64, a PDF as base64 — not its name.
{
"initial": "@d100.xml",
"corectat": "@d100-rectificat.xml"
}
In this example, @d100.xml, @d100-rectificat.xml stand in for whole documents: send the file content — XML as text or base64, a PDF as base64 — not its name.
Query parameters
How it behaves
- Returns a DRAFT declaration in the shape that
{form}/buildaccepts, derived from data you already hold. Two sources, depending on the form: D390 and D394 are derived from a batch of e-Factura invoices (CIUS-RO), while D710 is derived from two D100 declarations — the one you filed and the corrected one. - D390: keeps only invoices to intra-community customers (an EU country ≠ RO, with a VAT id), grouped by (VAT id, type) with the net base in whole lei. CIUS-RO does not tell goods from services, so the type defaults to
L(supplies) — set it per row (L/T/A/P/S/R). - D394: keeps domestic B2B invoices (a RO customer with a VAT id), grouped by (CUI, VAT rate) with base + VAT. The header (representative, preparer, CAEN, phone) cannot be derived from invoices and remains to be completed — see
warnings. - D710 (amending a D100): the body is
{initial, corectat}— the two D100 declarations (XML or base64), the one you filed and the corrected one. Obligations are matched on (obligation code, budget code) and the amounts go into D710's_i/_cpairs. The mapping is 1:1, no heuristics: D710 carries exactly the same amounts as D100, just split across two columns. Only the obligations whose amounts actually differ stay in the draft (that is what an amending return means);nr_neschimbatetells you how many were left untouched. Derivation is refused outright if the two declarations cover different periods, belong to different CUIs, or differ in nothing at all. - It is a draft to review, not a final declaration: check the rows and warnings, complete the flagged fields, then send the result to
POST /anaf/v1/declaratii/{form}/build. An invalid invoice in the batch is skipped with a warning, it does not stop the derivation. - Zero retention and no SPV submission — nothing is filed or definitively built here.
What it is for
- Quick-starting a D390/D394 from the month's invoices, without re-keying partners and bases by hand.
- Amending a D100 you already filed: hand over the old declaration and the correct version, get back the D710 with its "initial"/"corrected" columns already filled in, instead of transcribing them by hand.
Response structure
{form}/build accepts.
RO prefix.
RO prefix.
Response examples
body: {"luna": 9, "an": 2026, "declarant": {"cui": "990000005", "den": "Exemplu Furnizor SRL"}, "facturi": ["@efactura.xml"]}
{
"data": {
"formular": "D394",
"draft": {
"luna": 9,
"an": 2026,
"tip_D394": "L",
"declarant": {
"cui": "990000005",
"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
}
]
},
"warnings": [
{
"cod": "atentie",
"mesaj": "Toate rândurile au fost derivate cu tip „L\" (livrări) și tip_partener „1\" (persoană înregistrată în scopuri de TVA). Verifică pentru fiecare partener tipul operațiunii (A/L/C/V/LS/AS/AI/N) și tipul de partener (1–4).",
"camp": "parteneri"
}
],
"nr_facturi": 1,
"nr_randuri": 1
},
"meta": {
"generat_la": "2026-10-06T23: 59: 42+03: 00",
"note": "Rezultatul e un DRAFT de revizuit, nu o declarație finală: verifică rândurile și avertismentele, completează câmpurile marcate, apoi trimite draftul la POST /anaf/v1/declaratii/D394/build. Nu s-a depus și nu s-a construit nimic definitiv."
}
}
body: {"luna": 9, "an": 2026, "declarant": {"cui": "990000005", "den": "Exemplu Furnizor SRL"}, "facturi": ["@efactura-intracomunitara.xml"]}
{
"data": {
"formular": "D390",
"draft": {
"luna": 9,
"an": 2026,
"declarant": {
"cui": "990000005",
"den": "Exemplu Furnizor SRL"
},
"operatiuni": [
{
"tip": "L",
"tara": "DE",
"cod": "999000009",
"denumire": "Exemplu Client GmbH",
"baza": 1200
}
]
},
"warnings": [
{
"cod": "atentie",
"mesaj": "Factura #1 e în EUR — baza e însumată în moneda facturii; convertește manual în lei înainte de depunere.",
"camp": "facturi.0"
}
],
"nr_facturi": 1,
"nr_randuri": 1
},
"meta": {
"generat_la": "2026-10-06T23: 59: 42+03: 00",
"note": "Rezultatul e un DRAFT de revizuit, nu o declarație finală: verifică rândurile și avertismentele, completează câmpurile marcate, apoi trimite draftul la POST /anaf/v1/declaratii/D390/build. Nu s-a depus și nu s-a construit nimic definitiv."
}
}
body: {"initial": "@d100.xml", "corectat": "@d100-rectificat.xml"}
{
"data": {
"formular": "D710",
"draft": {
"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": "25.10.2026",
"nr_evid": "1",
"suma_dat_i": 1200,
"suma_dat_c": 1850,
"suma_ded_i": 0,
"suma_ded_c": 0,
"suma_plata_i": 1200,
"suma_plata_c": 1850,
"suma_rest_i": 0,
"suma_rest_c": 0
}
]
},
"warnings": [],
"nr_obligatii": 1,
"nr_neschimbate": 0
},
"meta": {
"generat_la": "2026-10-06T23: 59: 42+03: 00",
"note": "Rezultatul e un DRAFT de revizuit: conține doar obligațiile ale căror sume diferă între cele două D100 (restul, 0, au rămas neschimbate și nu se rectifică). Verifică-l, completează temeiul dacă e cazul, apoi trimite-l la POST /anaf/v1/declaratii/D710/build."
}
}
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 | Non-derivable form (only D390 and D394). |
| 422 | xml_invalid | Invalid luna/an or missing facturi. |
| 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": "Invalid luna/an or missing facturi.",
"camp": "form",
"request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
}
}