download_document
Save a rendered PDF or XML of an invoice or sales document by type and ID; returns path and URI without file bytes.
Instructions
Save the rendered PDF of an invoice or another sales document.
One API call. Reports path and uri and keeps the bytes out of the
answer, exactly as download_file does. For a link a person can
click, call get_deeplink with the same id.
A draft has not been rendered and cannot be downloaded. An XRechnung is XML by nature and its PDF is only a preview. A ZUGFeRD document is a PDF with the XML inside it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"document_type": "<document_type>",
"document_id": "<document_id>"
},
"name": "download_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | The document's Lexware id, as returned by search_vouchers. | |
| file_format | No | Which representation to fetch. 'pdf' is what almost everything has. 'xml' only exists for an XRechnung, and asking for it otherwise is a not-found. | |
| document_type | Yes | Which kind of document this is. Take it from the `voucherType` search_vouchers reported, where a sales invoice is 'invoice'. Either spelling works, 'creditnote' or 'credit-note'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | Resource URI for the same file. Read it to get the bytes, wherever the server runs. | |
| path | Yes | Where the file was written on the server. | |
| size | Yes | Size in bytes. | |
| mimeType | Yes | The file's content type. |