InvoiceSpec / Rules Registry / fatturapa-1-2 / FATTURAPA-IT-00311
fatal ASSERTION · FATTURAPA-IT-00311 FatturaPA 1.2.2 (Italian SdI) (UBL-2.1) Jurisdiction: IT

FATTURAPA-IT-00311: SdI Error 00311: Invalid CodiceDestinatario (must be 7 uppercase alphanumeric characters or 0000000 with PEC)

Official FatturaPA 1.2.2 (Italian SdI) Spec ↗
01. Technical Specification & XPath Evaluation Context

This rule validates the Italian 'CodiceDestinatario' (recipient code) within the FatturaPA header. The context XPath selects the CodiceDestinatario element under DatiTrasmissione. The assertion requires the value to match the regular expression ^[A-Z0-9]{7}$, i.e., exactly 7 uppercase alphanumeric characters. This corresponds to the SdI (Sistema di Interscambio) recipient code used for routing e-invoices. The rule is fatal because an invalid code prevents delivery. Note: The official message mentions an exception for '0000000' with PEC, but the raw XPath does not implement that exception; however, '0000000' itself matches the pattern, so it is allowed. The PEC condition is likely enforced elsewhere. The rule ensures compliance with the FatturaPA 1.2 specification for electronic invoicing in Italy.

Evaluated XPath Location:
/p:FatturaElettronica/FatturaElettronicaHeader/DatiTrasmissione/CodiceDestinatario
Deterministic Remediation Steps

1. Ensure the CodiceDestinatario value is exactly 7 characters long. 2. Use only uppercase letters (A-Z) and digits (0-9). 3. If the recipient does not have a CodiceDestinatario, use '0000000' and ensure a valid PEC address is provided in the PECDestinatario element (if applicable). 4. Remove any spaces, punctuation, or lowercase characters. 5. Validate the corrected value against the regex ^[A-Z0-9]{7}$ before resubmitting.

02. Side-by-Side UBL-2.1 Payload Diff (Rejected vs. Compliant)
--- a/invoice-rejected.xml (FATTURAPA-IT-00311) FAIL
1 <!-- Invalid CodiceDestinatario: contains lowercase letter and is 8 characters long -->
2 <DatiTrasmissione>
3 <CodiceDestinatario>abc12345</CodiceDestinatario>
4 </DatiTrasmissione>
+++ b/invoice-compliant.xml (EN 16931 VALID)
PASS
1 <DatiTrasmissione>
2 + <CodiceDestinatario>ABC1234</CodiceDestinatario>
3 </DatiTrasmissione>
03. Interactive FatturaPA 1.2.2 (Italian SdI) Validation & Auto-Fix Workbench
3 CREDITS
invoice.xmlUNKNOWN
DETECTED SOURCECustom ERP / Billing Engine
BT-131 LINE SUM0.00 EUR
BT-106 HEADER0.00 EUR
SCHEMATRON: 1 FATAL· 1ms
Peppol BIS Billing 3.0
BR-01Unrecognized XML Root or Missing EN 16931 Namespace
Spec & Diff
xpath: /

Input does not contain a valid OASIS UBL 2.1 <Invoice> or UN/CEFACT <rsm:CrossIndustryInvoice> root element.

fix: Ensure payload is valid UBL 2.1 or CII D16B XML, or drop an uncompressed ZUGFeRD/Factur-X PDF/A-3.

Automate Custom ERP / Billing Engine → Peppol BIS Billing 3.0 AP Delivery

Deploy certified Peppol Access Point & ZUGFeRD ERP connector

04. Adjacent FatturaPA 1.2.2 (Italian SdI) Assertions Browse All Rules →