oneapi
Sign in
Anaf v1 / SAF-T (D406)

Read D406

From a D406 it extracts the header and a summary: the declared period, the company, the record count for each section. The whole file is not returned — it holds tens of thousands of rows.

POST
https://oneapi.ro/api/anaf/v1/saft/parse

Request body

The request body is the whole document, sent raw (Content-Type: application/xml) — not an object with fields.

D406 return

saft-d406.xml application/xml · 17,5 KB — sent as is, in the request body.

A quarterly D406

saft-d406-trimestrial.xml application/xml · 17,5 KB — sent as is, in the request body.

An annual D406

saft-d406-anual.xml application/xml · 17,5 KB — sent as is, in the request body.

Query parameters

This route accepts no query parameters.

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 a D406 and returns a business JSON: the full header (company, period, currency, software) plus a per-section summary — counts (accounts, customers, suppliers, products, journals, invoices, payments…) and totals (debit/credit).
  • Because a real file is large, we return a structured summary, not an element-by-element transcription (which would be enormous). Enough to understand the shape and the key figures of the file.
  • Zero retention: parsing is stateless, in-memory.

What it is for

  • A quick inspection of a received/generated D406: what period it covers, how many documents, what totals.

Response structure

FieldTypeDescription
data.header object The header: company, address, period, currency, software, SAF-T version.
data.header.versiune string Version of the dataset or artefact the values come from.
data.header.tara string The country the value refers to.
data.header.data_creare string
data.header.software.nume string The name, exactly as the source publishes it.
data.header.software.id string
data.header.software.versiune string Version of the dataset or artefact the values come from.
data.header.firma.cui string Tax identification number, without the RO prefix.
data.header.firma.nume string The name, exactly as the source publishes it.
data.header.firma.adresa.strada string
data.header.firma.adresa.oras string
data.header.firma.adresa.cod_postal string
data.header.firma.adresa.tara string The country the value refers to.
data.header.moneda string Currency the values are expressed in.
data.header.perioada.luna_start string
data.header.perioada.an_start string
data.header.perioada.luna_end string
data.header.perioada.an_end string
data.header.segment string
data.rezumat object Counts and totals per section (master_files, journal, documents).
data.rezumat.master_files.conturi integer
data.rezumat.master_files.clienti integer
data.rezumat.master_files.cote_tva integer
data.rezumat.master_files.unitati_masura integer
data.rezumat.jurnal.nr_jurnale integer
data.rezumat.jurnal.nr_tranzactii integer
data.rezumat.jurnal.total_debit integer
data.rezumat.jurnal.total_credit integer
data.rezumat.documente.facturi_vanzari integer
meta.generat_la string When the response was built (ISO 8601).

Response examples

body: @saft-d406.xml

POSThttps://oneapi.ro/api/anaf/v1/saft/parse
{
    "data": {
        "header": {
            "versiune": "2.4.9",
            "tara": "RO",
            "data_creare": "2026-10-05",
            "software": {
                "nume": "Exemplu Software SRL",
                "id": "Exemplu ERP",
                "versiune": "1.0"
            },
            "firma": {
                "cui": "990000005",
                "nume": "Exemplu Furnizor SRL",
                "adresa": {
                    "strada": "Str. Memorandumului 28",
                    "oras": "Cluj-Napoca",
                    "cod_postal": "400114",
                    "tara": "RO"
                }
            },
            "moneda": "RON",
            "perioada": {
                "luna_start": "9",
                "an_start": "2026",
                "luna_end": "9",
                "an_end": "2026"
            },
            "segment": "1"
        },
        "rezumat": {
            "master_files": {
                "conturi": 3,
                "clienti": 1,
                "cote_tva": 1,
                "unitati_masura": 1
            },
            "jurnal": {
                "nr_jurnale": 1,
                "nr_tranzactii": 2,
                "total_debit": 2057,
                "total_credit": 2057
            },
            "documente": {
                "facturi_vanzari": 2
            }
        }
    },
    "meta": {
        "generat_la": "2026-10-06T23: 59: 44+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.
422xml_invalidXML that cannot be parsed or is not a SAF-T file (root <AuditFile>).
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": "XML that cannot be parsed or is not a SAF-T file (root ``).",
        "camp": null,
        "request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
    }
}