Skip to main content

Overview

e-Factura is Romania’s electronic invoicing system managed by ANAF (National Agency for Fiscal Administration). All invoices (both B2B and B2C) must be reported to the SPV (Spațiul Privat Virtual) platform. Contazen provides seamless integration with the e-Factura system, handling the OAuth2 authentication, XML generation, and submission processes automatically.

Prerequisites

Before using e-Factura features through the API, ensure your account is properly configured:
  1. ANAF OAuth2 Setup: Complete the OAuth2 authorization flow in your Contazen dashboard
  2. Environment Selection: Choose between test (sandbox) or live (production) mode
  3. Proper Firm Registration: Ensure your firm details (CUI, address, etc.) are accurate

Setup Process

1. Check e-Factura Status

First, verify your e-Factura configuration using the Settings endpoint:

2. e-Factura Settings Response

The settings response includes comprehensive e-Factura status information:

3. Manual OAuth Setup

If oauth_configured is false, you’ll need to complete the OAuth setup in the Contazen dashboard before using the API endpoints.

Creating e-Factura Compatible Invoices

Invoice Requirements

For invoices to be eligible for e-Factura submission:
  1. Document Type: Must be fiscal
  2. Client Type: B2B with valid Romanian CUI or B2C (CNP is optional, use - if not available)
  3. Complete Data: All required fields must be present
  4. Status: Invoice must be finalized (not draft)
  5. UBL Compliance: Items should include proper UBL unit codes

UBL Unit Codes for e-Factura

The Romanian e-Factura system requires UBL (Universal Business Language) unit codes for proper classification. Contazen automatically handles this with intelligent defaults and mappings.

Default Behavior

  • Default Unit: If no ubl_um is specified, defaults to H87 (bucată/piece)
  • Auto-mapping: System maps common Romanian units to UBL codes automatically
  • Validation: Invalid codes generate warnings but don’t block invoice creation
  • e-Factura Status: efactura_enabled defaults to true for fiscal invoices

Common UBL Unit Codes

UBL codes are case-insensitive. Both H87 and h87 work correctly.

Example Invoice Creation

Basic Invoice with UBL Units

Advanced e-Factura Compliance

For full e-Factura compliance, include additional UBL classification codes:

UBL Field Reference

When creating invoice items for e-Factura, you can include these UBL-related fields:
Auto-mapping: If you only provide unit (e.g., “ore”), Contazen automatically maps it to the correct UBL code (HUR). The system includes pre-configured mappings for common Romanian units.

UBL Validation Rules

  • UBL codes are case-insensitive (HUR, hur, Hur all work)
  • Invalid codes generate warnings but don’t block invoice creation
  • System defaults to H87 if invalid code is provided
  • All validation happens server-side automatically
  • System checks your firm’s custom unit mappings first
  • Falls back to built-in mappings for common units:
    • "ore""HUR"
    • "bucăți", "buc""H87"
    • "kg", "kilogram""KGM"
    • "metru", "m""MTR"
  • Custom mappings can be configured in your dashboard
  • Every invoice item must have a UBL unit code for e-Factura
  • System ensures compliance by providing defaults
  • Discounts automatically use H87 (piece)
  • All codes are validated against UBL standards

UBL Resources and References

Official UBL Unit Codes

Complete list of UBL unit codes from PEPPOL documentation

Combined Nomenclature (CN)

EU database for product classification codes

Common Procurement Vocabulary

CPV codes for public procurement classification

ANAF e-Factura Docs

Official Romanian e-Factura documentation
Quick Start: For most use cases, you only need ubl_um. The system will handle the rest automatically. Use HUR for time-based services and H87 for physical products.

Sending Invoices to SPV

Basic SPV Submission

Once you have a fiscal invoice, submit it to the e-Factura system:

Environment Override

You can override the default environment (test/live) for specific submissions:

Successful Response

Tracking Submission Status

Using Expand Parameter

Retrieve invoice details with e-Factura status:

Response with e-Factura Status

Voiding e-Factura Invoices

Standard Void Process

When voiding an invoice that was sent to e-Factura, the system automatically sends a cancellation message to ANAF:

Void Response

Error Handling

Common e-Factura Errors

OAuth Not Configured

Error Code: efactura_oauth_not_configuredSolution: Complete OAuth setup in dashboard before using API endpoints.

Already Sent to SPV

Error Code: already_sent_to_spvSolution: Check invoice status before attempting submission.

Invalid Document Type

Error Code: invalid_document_typeSolution: Only fiscal invoices can be sent to e-Factura.

Draft Invoice

Error Code: invoice_is_draftSolution: Finalize the invoice before submitting to SPV.

Error Response Example

Retry Logic for Failures

Implement retry logic for temporary failures:

Best Practices

1. Environment Management

  • Development: Always start with test environment
  • Production: Switch to live only after thorough testing
  • Token Management: Monitor OAuth token expiration dates

2. Error Handling

3. Batch Processing

For multiple invoices, implement proper rate limiting:

4. Status Monitoring

Regularly check submission status for long-running processes:

Integration Checklist

1

Configure OAuth

Complete the e-Factura OAuth setup in your Contazen dashboard
2

Test Environment

Start with test environment to validate your integration
3

Create Test Invoice

Create a fiscal invoice with valid Romanian client data
4

Submit to SPV

Test the send-to-spv endpoint with your test invoice
5

Handle Errors

Implement proper error handling for all scenarios
6

Monitor Status

Use the expand parameter to track submission status
7

Production Ready

Switch to live environment when ready for production

Support and Resources

  • Dashboard: Complete OAuth setup at app.contazen.ro
  • ANAF Documentation: Official e-Factura technical documentation
  • Support: Contact contact@contazen.ro for integration help
  • Status Page: Monitor API status and e-Factura system availability

Compliance Notes

  • Mandatory Reporting: All invoices (B2B and B2C) must be reported to SPV
  • Deadlines: Invoices must be submitted within legal deadlines (typically 5 days)
  • Data Accuracy: Ensure all client and invoice data is accurate before submission
  • Record Keeping: Maintain records of all e-Factura submissions for audit purposes
  • B2C Requirements: CNP is optional for B2C clients - use - if not available