How We Integrate ANAF e-Factura into a Custom ERP
Mandatory e-invoicing caught many companies unprepared. If you run a custom ERP or an in-house invoicing solution, integrating with the ANAF SPV system is possible through a REST API. Here is how we approach this integration in our projects.
What is ANAF e-Factura?
E-Factura is Romania's mandatory national electronic invoicing system, operated by ANAF (the national tax authority). Since 2024, issuing and submitting B2B invoices in UBL 2.1 XML format through the SPV (the Virtual Private Space) has been mandatory for taxable companies in Romania.
Integration architecture
Integrating from a custom ERP involves three main components:
- Generating the UBL 2.1 XML — converting the ERP data into the format required by ANAF
- OAuth 2.0 authentication with the SPV using a digital certificate or an access token
- Submission and monitoring through the ANAF e-Factura REST API
Technical implementation steps
1. Generating the XML file
ANAF accepts UBL 2.1 (Universal Business Language). The XML file must contain: supplier/customer details, invoice lines with CPV codes, VAT broken down by rate, the currency and the BNR exchange rate.
2. Authentication
The ANAF API uses OAuth 2.0 with short-lived access tokens (60 minutes). The ERP application must handle automatic token refresh and store the credentials securely.
3. Submitting the invoice
POST https://api.anaf.ro/prod/FCTEL/rest/upload
Content-Type: multipart/form-data
Authorization: Bearer {access_token}
file: [signed_invoice.xml]
cif: [company_tax_id]
4. Checking the status
ANAF returns a transaction ID. It has to be checked periodically (polling), or via webhook if ANAF enables that feature.
Possible statuses: ok, nok, in prelucrare (processing).
What we offer
In our custom ERP projects we implement the e-Factura module as a separate, testable component, with support for invoicing in RON and foreign currency, automatic generation on order confirmation and local XML archiving. Contact us for an assessment of the integration with your existing system.