The Developer’s Guide to Italy’s FatturaPA — From Data Schema to Successful XML Submission

Italy’s e‑invoicing regime is one of the most mature in Europe — and one of the most exacting. For tech leaders and policy-makers, FatturaPA is more than an XML — it is a business process, a compliance interface, and an integration pattern with the state. This guide distills the standards into pragmatic steps you can ship, with a focus on GovTech & LegalTech integration, data governance, and operational reliability.

What FatturaPA Is — And Who Must Comply

FatturaPA is Italy’s mandatory e‑invoice format. All B2B and B2C invoices issued by Italian VAT‑registered entities route through the government’s exchange platform — the Sistema di Interscambio (SDI). Public sector invoices (B2G) also pass via SDI and follow the same core model with sector‑specific nuances.

  • Scope:
    • B2G — mandatory since 2014
    • B2B/B2C — mandatory since 2019
    • Cross‑border — reported via SDI using dedicated document types
  • Core artifacts:
    • FatturaPA XML file — your canonical invoice
    • SDI transport channel — how you deliver the XML
    • SDI receipts — machine‑readable acknowledgments and errors you must store

In plain terms — your ERP emits structured XML, SDI validates and forwards it, and the receipts you receive are legal evidence of status.

Architecture Overview — How Your System Talks To SDI

At a high level, you map ERP data to FatturaPA XML, validate, transmit to SDI, then consume and reconcile SDI receipts asynchronously.

  • Actors:
    • Issuer — your system or service provider
    • Recipient — customer, PA, or consumer
    • SDI — validation and routing hub operated by the tax authority
  • Environments:
    • Test/collaudo — available after channel accreditation
    • Production — live SDI

SDI Transport Channels — Comparison

Channel
Transport
Best For
Pros
Cons
PEC
Certified email
Low volume, quick start
Minimal setup, legal trace via PEC
Manual ops, throttling, harder to automate
SDICoop (Web Services)
SOAP over TLS mTLS
Productized, scalable integrations
Programmatic, near real‑time, robust
Requires accreditation, certs, IP allowlisting
SDIFTP
SFTP
High‑volume batch
Throughput, resilient batch flows
Batch latency, file orchestration complexity
Web portal
Browser upload
Micro volumes, back‑office
No engineering
Manual, non‑scalable

Rule of thumb — product teams should aim for SDICoop for resilience and observability; SDIFTP if you are a batch processor.

The FatturaPA Data Model — What You Must Map

FatturaPA is a structured XML with strict cardinalities and code lists. You will map the following essentials:

  • Header — `FatturaElettronicaHeader`
    • `DatiTrasmissione` — `ProgressivoInvio` (idempotency key), `FormatoTrasmissione` (FPR12 for B2B/B2C, FPA12 for PA), `CodiceDestinatario` (7‑char routing code), optional `PECDestinatario`
    • `CedentePrestatore` — supplier legal/fiscal identity, VAT ID (Partita IVA), tax code (Codice Fiscale), address
    • `CessionarioCommittente` — customer identity (VAT or CF), address
    • `TerzoIntermediarioOSoggettoEmittente` — if an intermediary submits on your behalf
  • Body — `FatturaElettronicaBody`
    • `DatiGenerali` — `TipoDocumento` (e.g., TD01 invoice, TD02 advance), `Divisa`, dates, references
    • `DatiBeniServizi` — line items (`DettaglioLinee`), VAT rates, totals
    • `DatiRiepilogo` — VAT summary per rate or nature code
    • `DatiPagamento` — method, due dates, IBAN
    • Special blocks when applicable — `DatiCassaPrevidenziale`, `DatiRitenuta`, `DatiBollo`, `DatiDDT`, `DatiTrasporto`
  • Totals — strictly consistent with lines and VAT summaries

Key routing fields:

  • `CodiceDestinatario` — business endpoint code (7 chars); use `0000000` for private consumers
  • `PECDestinatario` — certified email, used when no endpoint code is available
  • Public Administration uses IPA codes and the `FPA12` format

Minimal Valid FatturaPA XML — A Compact Example

<?xml version=”1.0″ encoding=”UTF-8″?>
<p:FatturaElettronica versione=”FPR12″ xmlns:p=”http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2″>
<FatturaElettronicaHeader>
<DatiTrasmissione>
<IdTrasmittente>
<IdPaese>IT</IdPaese>
<IdCodice>01234567890</IdCodice>
</IdTrasmittente>
<ProgressivoInvio>INV-2025-000123</ProgressivoInvio>
<FormatoTrasmissione>FPR12</FormatoTrasmissione>
<CodiceDestinatario>ABCDEF1</CodiceDestinatario>
</DatiTrasmissione>
<CedentePrestatore>
<DatiAnagrafici>
<IdFiscaleIVA>
<IdPaese>IT</IdPaese>
<IdCodice>01234567890</IdCodice>
</IdFiscaleIVA>
<Anagrafica><Denominazione>Acme S.r.l.</Denominazione></Anagrafica>
<RegimeFiscale>RF01</RegimeFiscale>
</DatiAnagrafici>
<Sede><Indirizzo>Via Roma 1</Indirizzo><CAP>00100</CAP><Comune>Roma</Comune><Provincia>RM</Provincia><Nazione>IT</Nazione></Sede>
</CedentePrestatore>
<CessionarioCommittente>
<DatiAnagrafici>
<IdFiscaleIVA><IdPaese>IT</IdPaese><IdCodice>09876543210</IdCodice></IdFiscaleIVA>
<Anagrafica><Denominazione>Client S.p.A.</Denominazione></Anagrafica>
</DatiAnagrafici>
<Sede><Indirizzo>Corso Italia 10</Indirizzo><CAP>20100</CAP><Comune>Milano</Comune><Provincia>MI</Provincia><Nazione>IT</Nazione></Sede>
</CessionarioCommittente>
</FatturaElettronicaHeader>

<FatturaElettronicaBody>
<DatiGenerali>
<DatiGeneraliDocumento>
<TipoDocumento>TD01</TipoDocumento>
<Divisa>EUR</Divisa>
<Data>2025-10-19</Data>
<Numero>2025-123</Numero>
<ImportoTotaleDocumento>122.00</ImportoTotaleDocumento>
</DatiGeneraliDocumento>
</DatiGenerali>

<DatiBeniServizi>
<DettaglioLinee>
<NumeroLinea>1</NumeroLinea>
<Descrizione>Software subscription — 1 month</Descrizione>
<Quantita>1.00</Quantita>
<PrezzoUnitario>100.00</PrezzoUnitario>
<PrezzoTotale>100.00</PrezzoTotale>
<AliquotaIVA>22.00</AliquotaIVA>
</DettaglioLinee>
<DatiRiepilogo>
<AliquotaIVA>22.00</AliquotaIVA>
<ImponibileImporto>100.00</ImponibileImporto>
<Imposta>22.00</Imposta>
<EsigibilitaIVA>I</EsigibilitaIVA>
</DatiRiepilogo>
</DatiBeniServizi>

<DatiPagamento>
<CondizioniPagamento>TP02</CondizioniPagamento>
<DettaglioPagamento>
<ModalitaPagamento>MP05</ModalitaPagamento>
<DataScadenzaPagamento>2025-11-18</DataScadenzaPagamento>
<ImportoPagamento>122.00</ImportoPagamento>
</DettaglioPagamento>
</DatiPagamento>
</FatturaElettronicaBody>
</p:FatturaElettronica>

Tip — keep amounts at two decimals, ensure line totals sum to taxable base and VAT summaries exactly.

Validation & Pre‑Flight — What To Check Before Sending

  • XSD compliance — validate against the official FatturaPA XSDs
  • Controlled vocabularies — `TipoDocumento`, `Natura` (e.g., N2.x, N3.x, N4), `ModalitaPagamento`, `RegimeFiscale`
  • Identity data — supplier’s VAT/CF, customer’s VAT/CF or CF for consumers
  • Routing — `CodiceDestinatario` or `PECDestinatario`, use `0000000` for B2C
  • Tax math — per‑line totals, VAT per summary bucket, global totals
  • Special flags — `EsigibilitaIVA` (I immediate, D deferred, S split payment for PA), `DatiBollo` for virtual stamp when applicable
  • Idempotency — unique `ProgressivoInvio` per submission

Submission Flow — From XML To Receipt

  1. Generate XML — map ERP data, normalize decimals, encode UTF‑8.
  2. Optional signing — some PA workflows may still require a signature; B2B/B2C typically accept unsigned XML.
  3. Transmit via chosen channel — SDICoop, SDIFTP, or PEC.
  4. Poll/receive SDI outcomes — parse and persist machine‑readable receipts.
  5. Forwarding to recipient — SDI delivers to the endpoint code or PEC; for consumers, SDI stores the invoice in the tax portal.
  6. Reconciliation — match SDI protocol numbers to your invoice records, update status, and trigger downstream actions (posting, dunning, archiving).

SDI Receipts — What They Mean

  • Scarto (Reject) — file rejected, not delivered; fix and resend with a new `ProgressivoInvio`
  • Ricevuta di Consegna (Delivery Receipt) — delivered to recipient endpoint
  • Notifica di Mancata Consegna (Failed Delivery) — undeliverable; SDI makes it available in the tax portal; your duty is still met
  • Decorrenza Termini (Timeout) — no recipient acknowledgment in PA flows; treat as delivered after the legal window
  • Esito Committente (Customer Outcome) — applicable in PA flows within a defined period

Persist all receipts — they are part of your legal audit trail.

Error Handling — Typical SDI Error Categories

Category
Symptom
How To Fix
Structural/XSD
“File non conforme”, schema violations
Regenerate XML to match XSD; validate in CI
Identity
VAT/CF mismatch, invalid country codes
Cross‑check master data; sanitize inputs
Routing
Invalid CodiceDestinatario or PEC
Confirm 7‑char code; fallback to PEC or 0000000
Arithmetic
Totals don’t match summaries
Recompute rounding at source; avoid floating drift
Codes & Flags
Wrong TipoDocumento, Natura, EsigibilitaIVA
Align with tax logic engine and code lists
Duplicates
“File già presente”
Change ProgressivoInvio; enforce idempotency rules
Forbidden combos
Incompatible blocks (e.g., bollo with zero VAT when not applicable)
Follow official compatibility tables

Build deterministic, human‑readable error mapping so support can resolve issues in minutes — not hours.

Security, Privacy & Retention — What Compliance Entails

  • Transport security — mTLS for SDICoop; strict IP allowlisting; certificate rotation
  • Data minimization — only legally required invoice fields; avoid free‑text PII
  • Logging — redact sensitive fields, hash identifiers where possible
  • Archiving (conservazione digitale) — preserve invoices and SDI receipts for statutory periods, with time‑stamps and integrity guarantees; consider a certified conservator or the tax authority’s service
  • GDPR & eIDAS — define lawful basis, data processor roles, and e‑signature policies where used
  • Access control — least privilege in ERP, invoicing service, object storage

Cross‑Border & Special Cases — Don’t Miss These

  • Reverse charge & split payment — model via `TipoDocumento`, `Natura` and `EsigibilitaIVA`
  • Virtual stamp duty — `DatiBollo` when thresholds or document types require it
  • Cross‑border reporting — use dedicated document types (e.g., TD17/TD18/TD19) per official tables for purchases and services with foreign counterparties
  • Withholding & social funds — `DatiRitenuta`, `DatiCassaPrevidenziale` for specific professions
  • Public Administration specifics — `FPA12`, IPA codes, and possible customer outcome messages

Design your rules engine so document type and tax scenarios are fully data‑driven — not hard‑coded.

Build vs Buy — Connecting To SDI Directly Or Via A Provider

  • Direct SDI accreditation — maximum control, no vendor lock‑in, but requires certificates, compliance ops, and 24/7 monitoring
  • Intermediary/provider — faster time‑to‑market, managed updates and archiving, but recurring fees and vendor dependency

Decision criteria — volume, in‑house Ops maturity, required SLAs, and regulatory posture. Many teams start with a provider, then insource SDICoop when scale and stability justify it.

Implementation Plan — A Practical, Low‑Risk Path

  1. Discovery — map business flows, document types, code lists, and edge cases
  2. Data model — define a canonical invoice schema; add a strict adapter to FatturaPA
  3. Validation — embed XSD checks and business rules in CI; add test fixtures
  4. Transport — choose SDICoop; prepare mTLS, IP ranges, retries, backoff, and DLQs
  5. Observability — correlation ids, receipt parsing, dashboards, alerts
  6. Archiving — immutable storage of XML and receipts; retention policies
  7. Rollout — pilot a subset of customers, compare SDI totals to ERP ledgers, expand gradually

Go‑Live Checklist — Pin Down The Last Mile

  • Unique `ProgressivoInvio` strategy — deterministic, collision‑safe
  • Code lists up‑to‑date — `TipoDocumento`, `Natura`, payment modes
  • Totals parity — unit tests for rounding and VAT per bucket
  • Receipt consumption — every receipt mapped to a terminal status
  • Retries & idempotency — safe re‑submission without double‑posting
  • Backfilling plan — late or corrected invoices with credit notes (TD04) as needed
  • Conservazione — archiving vendor or state service enabled and tested

Aligning With EU Directions — Future‑Proof Your Stack

Italy’s model is converging with broader EU digital reporting and e‑invoicing initiatives. Keep your architecture adaptable — externalize code lists, version transformation logic, and isolate SDI transport behind an interface so migrating to additional networks (e.g., PEPPOL) or future EU schemas is incremental — not a rewrite.

Key Takeaways

  • FatturaPA is a precise XML plus an integration with SDI — treat both data quality and transport as first‑class concerns.
  • Build a canonical invoice model and a strict, tested adapter — then add SDI transport with robust observability and archiving.
  • Start with SDICoop for programmatic control or a provider for speed — but design for portability and evolving EU requirements.