ediverse Explore the platform

Spotlight PEPPOL BIS Billing 3.0 The EU e-invoicing mandate is here — France Sept 2026, Belgium Jan 2026, Germany 2025.

SAF-T (PT) — the world's first SAF-T implementation, since 2008

SAF-T (PT) — the Portuguese Standard Audit File for Tax — is a normalised XML file that every Portuguese accounting or billing software must be able to produce. Built on the OECD SAF-T recommendation (2005), Portugal turned it into the world's first mandatory national deployment in 2008. It is the foundation of the entire Portuguese digital-tax edifice — and an 18-year head-start over the EU's Digital Reporting (ViDA).

History — from OECD 2005 to Portugal 2008

In 2005 the OECD published its Guidance for the Standard Audit File — Tax: the idea is that a tax inspector can ask any business for an XML file in an identical format, containing the general ledger, invoices, payments and product records. No more unreadable proprietary exports — automated auditing instead. But the OECD only recommends.

Portugal was the first country to turn that recommendation into a legal obligation. Decreto-Lei n.º 238/2006 (28 December 2006) embeds the obligation in the Código do IRC and the accounting- obligations regime. Portaria n.º 321-A/2007 (26 March 2007) publishes the exact XML schema. From 1 January 2008, any accounting software used in Portugal must be able to generate a conformant SAF-T (PT).

A second major turning point came in 2013: Portarias 160/2013 and 274/2013 extended SAF-T to billing (the SourceDocuments / SalesInvoices block) and required monthly submission of every issued invoice to the AT — the birth of the e-fatura system. SAF-T stopped being a mere on-request audit file and became a recurring reporting flow.

text saf-t-pt-timeline.txt
2005       | The OECD publishes the Guidance on Standard Audit File for Tax
           | (SAF-T 1.0) — an XML accounting-export format to enable
           | automated tax audits. It is a RECOMMENDATION, not a mandate.
           |
2006       | Portugal transposes it into national law via Decreto-Lei
           | n.º 238/2006 (28 December) — the first country in the world
           | to make SAF-T legally binding.
           |
2007       | Portaria n.º 321-A/2007 (26 March) sets the exact SAF-T (PT)
           | file structure: XML schema, enumerations, obligations.
           |
2008       | 1 January — entry into force. Every accounting package used
           | in Portugal must be able to export a SAF-T (PT) on AT request.
           |
2013       | Portaria n.º 160/2013 then 274/2013 extend SAF-T to BILLING
           | (SourceDocuments). Monthly submission of invoices to the AT
           | (e-fatura) from 1 January 2013.
           |
2017       | Schema version 1.04_01 — TaxonomyReference alignment, fields
           | tied to software certification added.
           |
2019-2020  | ATCUD placeholder fields and QR-code preparation added.
           | Portaria 302/2016 on series communication.
           |
2023-2026  | SAF-T (PT) remains the cornerstone: it feeds VAT pre-filing,
           | e-fatura, and the base for the future ViDA Digital Reporting
           | (Portugal already ready).

Governance — Autoridade Tributária (AT)

SAF-T (PT) is governed by the Autoridade Tributária e Aduaneira (AT), the Portuguese tax authority, through the Portal das Finanças. The AT publishes the official XSD schema, the code enumerations (TaxCode, InvoiceType, MovementType) and the technical notes. Every schema change is enacted by a Despacho (administrative decision) and a new version (e.g. 1.03 → 1.04_01).

The AT checks file consistency through strict server-side XSD validation on e-fatura submission, and by cross-referencing the periodic VAT return (Declaração Periódica do IVA). A software vendor producing an invalid SAF-T cannot get its software certified (see the software certification 2010 page).

Technical schema — XML, SAF-T_PT 1.04_01

SAF-T (PT) is a single XML document validated by an XSD schema. The root namespace is urn:OECD:StandardAuditFile-Tax:PT_1.04_01. The historical encoding is Windows-1252 (UTF-8 tolerated). It is built from four major blocks:

  • Header — company identity (NIF / CompanyID), period, currency, and crucially the SoftwareCertificateNumber (AT certification number) and ProductID.
  • MasterFiles — reference data: customers (Customer), suppliers (Supplier), products (Product), tax-rate table (TaxTable).
  • GeneralLedgerEntries — accounting entries (for the accounting SAF-T).
  • SourceDocuments — commercial documents: SalesInvoices (invoices), MovementOfGoods (transport guides), WorkingDocuments, Payments.
xml saf-t-pt-1.04_01-sample.xml
<?xml version="1.0" encoding="Windows-1252"?>
<AuditFile xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.04_01">
  <Header>
    <AuditFileVersion>1.04_01</AuditFileVersion>
    <CompanyID>509876543</CompanyID>
    <TaxRegistrationNumber>509876543</TaxRegistrationNumber>
    <TaxAccountingBasis>F</TaxAccountingBasis>
    <CompanyName>Lusitania Trading Lda</CompanyName>
    <FiscalYear>2026</FiscalYear>
    <StartDate>2026-06-01</StartDate>
    <EndDate>2026-06-30</EndDate>
    <CurrencyCode>EUR</CurrencyCode>
    <ProductCompanyTaxID>500111222</ProductCompanyTaxID>
    <SoftwareCertificateNumber>1234</SoftwareCertificateNumber>
    <ProductID>FaturaPro/Nucleo Software Lda</ProductID>
    <ProductVersion>8.2.1</ProductVersion>
  </Header>
  <SourceDocuments>
    <SalesInvoices>
      <NumberOfEntries>1</NumberOfEntries>
      <TotalDebit>0.00</TotalDebit>
      <TotalCredit>1000.00</TotalCredit>
      <Invoice>
        <InvoiceNo>FT 2026A/00417</InvoiceNo>
        <ATCUD>JFHA3T7N-417</ATCUD>
        <InvoiceStatus>N</InvoiceStatus>
        <Hash>kEr8...base64-RSA-SHA1...==</Hash>
        <InvoiceType>FT</InvoiceType>
        <SystemEntryDate>2026-06-12T10:14:33</SystemEntryDate>
        <CustomerID>00031</CustomerID>
        <Line>
          <LineNumber>1</LineNumber>
          <ProductCode>SRV-CONSULT</ProductCode>
          <Quantity>10</Quantity>
          <UnitPrice>100.00</UnitPrice>
          <Tax>
            <TaxType>IVA</TaxType>
            <TaxCountryRegion>PT</TaxCountryRegion>
            <TaxCode>NOR</TaxCode>
            <TaxPercentage>23.00</TaxPercentage>
          </Tax>
        </Line>
        <DocumentTotals>
          <TaxPayable>230.00</TaxPayable>
          <NetTotal>1000.00</NetTotal>
          <GrossTotal>1230.00</GrossTotal>
        </DocumentTotals>
      </Invoice>
    </SalesInvoices>
  </SourceDocuments>
</AuditFile>

SAF-T (PT) vs OECD SAF-T and national clones

Portugal's success set the template: SAF-T (PT) became the reference model — often copied verbatim down to the OECD namespace name — by many countries. Here is how it is positioned:

DimensionSAF-T (PT)OECD SAF-T (model)National clones
Year2008 (world first)2005 (recommendation)LU 2011, PL JPK 2016, LT i.SAF 2016, NO 2020, RO D406 2022
StatusMandatory (law)Non-bindingLocally mandatory
ScopeAccounting + billing + transportAccounting (v2 adds invoices)Variable (PL = accounting + JPK_VAT)
Billing frequencyMonthly (e-fatura)On requestPL monthly, RO monthly
Software-certification linkYes (certificate no. in Header)NoRare
Anti-fraud (chained hash)YesNoNo (RO partial)

Adoption — 100% of taxable persons

  • ~100% of Portuguese businesses produce SAF-T (PT): it is a legal obligation with no threshold, from micro-enterprise to large group (save for very specific simplified regimes).
  • Monthly e-fatura submission: invoices for month M must be communicated by the 5th of month M+1 (deadline relaxed several times; see e-fatura).
  • Vendor market: every package sold in Portugal (PHC, Sage, Primavera, Moloni, InvoiceXpress, Vendus…) ships a certified SAF-T export — it is a market-access condition.
  • European ripple effect: Poland (JPK), Lithuania (i.SAF), Norway, Romania (D406) all adopted the Portuguese model. Portugal remains the yardstick.

Common pitfalls

  • Confusing accounting SAF-T and billing SAF-T. They are two uses of the same schema: billing is submitted monthly (e-fatura), accounting is produced for the annual IES or on audit request. The populated block differs.
  • Windows-1252 encoding. Many legacy SAF-T files are encoded in Windows-1252, not UTF-8. Naïve reading breaks ã, ç, õ. Always honour the XML header's encoding declaration.
  • Forgetting the SoftwareCertificateNumber. The Header must contain the issuing software's AT certification number. A SAF-T without it (or with "0") is rejected for mandatory billing flows.
  • Breaking the Hash chain. Each invoice's hash incorporates the previous one. Reordering, deleting or regenerating invoices out of sequence breaks the chain — the AT detects it instantly. Numbering must be strictly sequential per series.
  • Wrong TaxCode. NOR (standard 23%), INT (intermediate 13%), RED (reduced 6%), ISE (exempt). A wrong code skews the pre-filled Declaração Periódica do IVA.