lookup_codice_destinatario
Validate the format of a CodiceDestinatario or PEC address to determine routing type before building transmission header.
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. 'ABC123') → routing_type: 'SDI_CODE'
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'
Limitation: performs format validation only — no live query against the SDI SOAP directory service (planned for a future release).
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 |
|---|---|---|---|
| codice | No | 6-character alphanumeric SDI CodiceDestinatario to look up. Special value '0000000' (7 zeros) indicates PEC routing. | |
| pec | No | PEC address to validate format (user@domain.ext). When a PEC is provided, CodiceDestinatario must be '0000000'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||