FatturaPA XML Structure Explained: FPR12 & FPA12

A practical reference to the Italian electronic invoice format — the XML schema every invoice must follow to pass through the SDI (Sistema di Interscambio), Italy's national exchange system.

The two transmission formats

Format Used for Recipient code
FPR12 B2B and B2C invoices (private parties) 7 alphanumeric characters (or 0000000 for consumers)
FPA12 Invoices to Public Administration 6 characters (IPA office code)

Both share schema version 1.2.x published by the Agenzia delle Entrate. The format is declared in the FormatoTrasmissione element.

Root element and namespaces

<p:FatturaElettronica versione="FPR12"
    xmlns:p="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2">
    <FatturaElettronicaHeader> ... </FatturaElettronicaHeader>
    <FatturaElettronicaBody> ... </FatturaElettronicaBody>
</p:FatturaElettronica>

Header blocks (FatturaElettronicaHeader)

  • DatiTrasmissione — sender's tax ID (IdTrasmittente), sequential file number (ProgressivoInvio), transmission format, recipient code (CodiceDestinatario) or certified e-mail (PECDestinatario).
  • CedentePrestatore — the supplier: VAT number, registered name, tax regime code (RegimeFiscale, e.g. RF01 ordinary, RF19 flat-rate "forfettario"), registered office address.
  • CessionarioCommittente — the customer: VAT number or codice fiscale, name, address.

Body blocks (FatturaElettronicaBody)

  • DatiGenerali — document type (TipoDocumento), currency, date, number, stamp duty (DatiBollo), withholding (DatiRitenuta), and PA-only references such as CIG/CUP.
  • DatiBeniServizi — invoice lines (DettaglioLinee: description, quantity, unit price, VAT rate or exemption nature code Natura) and VAT summary (DatiRiepilogo).
  • DatiPagamento — payment terms and methods (e.g. MP05 bank transfer), IBAN, due dates.

Document types (TipoDocumento)

The most common values: TD01 invoice, TD04 credit note, TD05 debit note, TD06 professional fee note, TD07/TD08 simplified invoice and credit note, TD16–TD19 reverse-charge integrations and self-billing for foreign purchases, TD24 deferred invoice. The full range goes up to TD28.

Validation: how SDI checks your file

Before delivery, SDI validates the XML against the official XSD schema and applies semantic checks (valid VAT numbers, consistent totals, allowed code combinations). A rejected file gets a notifica di scarto with an error code (e.g. 00200 malformed file, 00400 inconsistent Natura/VAT). You have 5 days to fix and resend.

Free tools to work with FatturaPA files (English-friendly):

  • FatturaPA viewer — render any FPR12/FPA12 XML or signed .p7m as a readable invoice, in your browser, with PDF export.
  • Official XSD validator — validate against the Agenzia delle Entrate schema with detailed error lines.
  • P7M extractor — extract the original XML (or PDF) from a CAdES-signed .p7m file.

Prova Fatturah.it — è gratis.

Fatturazione elettronica semplice, senza limiti e senza carta di credito.

Inizia Ora