E-Factura UBL 2.1 SPV ANAF

E-Factura integration

Everything you need to submit invoices to ANAF SPV via the Billyou API. UBL 2.1 is handled automatically: you provide structured data, we generate the XML.

UBL 2.1 XML format

ANAF requires invoices in the UBL 2.1 XML format, validated against the Romanian national XSD profile (CIUS-RO). Billyou automatically generates and validates the UBL XML from the structured data you provide through the API. You never need to construct or parse XML directly.

Billyou checks the generated XML locally against ~2,500 official EN16931 and CIUS-RO rules before submission, in parallel with ANAF's own validation. If validation fails, the API returns an error immediately rather than letting ANAF reject it.

Required fields

issuer.cui required Tax ID of the issuing company. Format: RO + numeric digits, or just numeric digits.
issuer.name required Legal name of the issuing company, as registered at ONRC.
issuer.address required Full address of the issuing company including city and county.
recipient.cui required Tax ID of the recipient company. Required for B2B E-Factura.
recipient.name required Legal name of the recipient.
items[].name required Name or description of the product or service.
items[].quantity required Numeric quantity. Must be positive.
items[].pricePerUnit required Unit price excluding VAT, in the invoice currency.
items[].vatRate required VAT rate as a number, at the rates in force since 1 August 2025: 21 (standard), 11 (reduced) or 0.
currency optional ISO 4217 currency code. Defaults to RON. Foreign currency invoices use the BNR rate from the invoice date.
spv optional Boolean. Set to true to automatically submit to ANAF SPV after creation.

Complete example

create-efactura.ts
const invoice = await billyou.invoices.create({
  issuer: {
    cui: 'RO12345678',
    name: 'My Company SRL',
    address: 'Strada Victoriei 12, Bucuresti',
  },
  recipient: {
    cui: 'RO87654321',
    name: 'Client SRL',
    address: 'Calea Floreasca 5, Bucuresti',
  },
  items: [{
    name: 'Servicii consultanta',
    unit: 'ora',
    quantity: 10,
    pricePerUnit: 125.00,
    vatRate: 19,
  }],
  currency: 'RON',
  spv: true,
});

SPV submission flow

1
Create invoice
POST to /v1/invoices with spv: true. Billyou validates the data and generates UBL XML.
2
XML validation
The generated XML is checked against ~2,500 official EN16931 and CIUS-RO rules. Errors are returned immediately, with a plain-language explanation for the most common ones.
3
ANAF authorisation
The invoice is sent on your company's behalf, using the ANAF authorisation granted once with your digital certificate. Billyou does not sign the XML; ANAF returns the validated invoice with its own electronic signature.
4
SPV submission
The XML is submitted to ANAF SPV. You receive an upload_id immediately.
5
ANAF processing
ANAF processes the invoice in its own time. Billyou tracks the status automatically and reports the result.
6
Status update
When ANAF responds, Billyou fires invoice.confirmed or invoice.rejected webhook events.

Error codes

E001
Invalid CUI
The CUI (tax ID) format is invalid. Must be ROxxxxxxxx or just the numeric part.
E002
Missing required field
A required field is absent. Check the error.field property for the field name.
E003
Duplicate invoice number
An invoice with this number already exists for your account. Use a unique series/number.
E100
ANAF SPV unavailable
ANAF infrastructure is temporarily unavailable. Billyou retries automatically.
E101
Invalid UBL format
The generated XML failed ANAF's XSD schema validation. Contact support with the invoice ID.
E200
VAT rate not applicable
The specified VAT rate is not applicable for this type of transaction.

Next steps