attach_file_to_voucher
Attach a PDF, JPEG, PNG, or XML file to an existing voucher instead of creating a new one, preventing undeletable duplicate vouchers. Confirm the organization before writing.
Instructions
Attach a file to a voucher that already exists.
Use this rather than upload_file when the voucher is there: that one
creates a new voucher for every file, and a voucher cannot be
deleted through the API, so the wrong choice leaves one behind for
good.
Writes to the account, and the API cannot take it back: there
is no call that detaches a file. Confirm the organization with
get_profile first. One API call, never retried.
Takes PDF, JPEG, PNG or XML, at most 5 MiB, from a path or a URL. The
answer is the new file id, which download_file reads back.
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": {
"voucher_id": "<voucher_id>",
"source": "<source>"
},
"name": "attach_file_to_voucher"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | The file: a path on this machine, or a URL to fetch it from. A URL works only for addresses the account owner allowed. | |
| voucher_id | Yes | The voucher to hang the file on, by id from search_vouchers. It has to exist already. |