add_allegato
Attach supporting documents (e.g., DDT, contract, PDF) to a FatturaPA invoice. Encodes file in base64 and returns attachment entry for XML generation.
Instructions
Build an Allegati (attachment) entry to include in a FatturaPA document.
Use this when you need to attach supporting documents (e.g. DDT, contract, PDF) to the invoice. Call once per file, collect results in a list, and pass it to generate_fattura_xml() as the allegati parameter.
attachment_base64 must be valid standard base64 (RFC 4648); the tool verifies decodability. nome_allegato must include the file extension (e.g. 'contract.pdf'). formato_allegato (e.g. 'PDF', 'XML', 'ZIP') is optional but recommended for recipients to identify the content without decoding.
On success returns {'Allegati': {'NomeAllegato', 'Attachment', 'size_bytes', ...}}. On failure returns {'error': ''} (invalid base64 or name > 60 chars).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nome_allegato | Yes | Attachment file name (NomeAllegato), max 60 chars. Include the extension (e.g. 'contract.pdf', 'ddt_001.pdf'). | |
| attachment_base64 | Yes | Base64-encoded content of the attachment. Any binary file is accepted; common formats: PDF, XML, JPG, ZIP. | |
| formato_allegato | No | MIME type or format description (FormatoAllegato), max 10 chars. Examples: 'PDF', 'XML', 'ZIP'. Optional but recommended. | |
| descrizione_allegato | No | Short description of the attachment content, max 100 chars. Optional. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||