lookup_codice_destinatario
Validates an SDI recipient code or PEC address for Italian e-invoicing, identifying the correct routing type. Prevents transmission header errors by confirming formatting before use.
Instructions
Validate the format of a CodiceDestinatario (SDI recipient code) or PEC address.
Call this before build_transmission_header() to confirm the recipient routing type and that the code or PEC address is correctly formatted. At least one of codice or pec must be provided.
Routing rules:
codice is 6 alphanumeric chars (e.g. 'A1B2C3') → routing_type: 'SDI_CODE' (PA/IPA, FPA12)
codice is 7 alphanumeric chars (e.g. 'X1Y2Z3W') → routing_type: 'SDI_CODE' (B2B intermediary, FPR12)
codice is '0000000' (7 zeros) → routing_type: 'PEC'; pec_destinatario is then mandatory in build_transmission_header()
pec only (no codice) → validates email format, routing_type: 'PEC'
IPA note: 6-char = IPA code (PA), 7-char = B2B intermediary code (FPR12 routing). PA office codes can be looked up at https://www.indicepa.gov.it. This tool performs format validation only, no live query against the SDI SOAP directory service or the IPA registry (planned for a future release).
Per-channel cap (reference only, not enforced here — this tool validates the format of a single code, not channel-wide allocation): per AdE Specifiche Tecniche 1.9.1 (in force 2026-05-15), an accredited reception channel (WS or SFTP) may request a maximum of 300 CodiceDestinatario codes via the Sistema di Accreditamento once it has passed to production. This cap is unrelated to, and does not change, the per-invoice 6/7-character format validated above.
On success returns a dict with 'routing_type', 'codice_destinatario' and/or 'pec_destinatario', and a 'note' with usage guidance. On invalid input returns {'error': ''}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pec | No | PEC address to validate format (user@domain.ext). When a PEC is provided, CodiceDestinatario must be '0000000'. | |
| codice | No | SDI CodiceDestinatario to look up: 6-char alphanumeric for PA offices (IPA code, FPA12 B2G invoices), 7-char alphanumeric for B2B intermediaries (FPR12), or '0000000' (7 zeros) for PEC routing. IPA codes can be verified at https://www.indicepa.gov.it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||