# Invoices, Payments and Credit Notes / Attach File to invoice > --- # Attach File to Invoice Uploads and attaches a file to an invoice record by sending a JSON payload containing file metadata and the file content encoded as Base64. It requieres an exist (API Dev… - Page: https://r.nizu.dev/knowledge_base/view/318-invoices-payments-and-credit-notes-attach-file-to-invoice - Part of: [Knowledge base](https://r.nizu.dev/knowledge_base/llms.txt) on NIZU DEV — https://r.nizu.dev/llms.txt - Updated: 2026-11-22T21:30:06Z --- # Attach File to Invoice Uploads and attaches a file to an invoice record by sending a JSON payload containing file metadata and the file content encoded as Base64. It requieres an existing invoice ID. Request - Method: `POST` - URL: [https://api.nizu.io/v2/](https://api.nizu.io/v2/) Description This endpoint attaches a file to an invoice-related module. The request body identifies: - the target module - the lookup key - the target record value - the file name - the file content as a Base64 string Request body Content type appears to be JSON. Example body: ``` json { "module": "invoice_files", "key": "id", "keyval": "6040", "file_name": "test.pdf", "base64_file": "" } ``` Field reference - `module` string The target module where the file should be attached. Example: `"invoice_files"` - `key` string The field used to identify the target entity. Example: `"id"` - `keyval` string The value of the identifier field for the target record. Example: `"6040"` - `file_name` string Name of the uploaded file, including extension. Example: `"test.pdf"` - `base64_file` string The full file content encoded as a Base64 string. Variables used - `{{base_url2}}` Base URL for the target API environment. Response Success response - Status: `200 OK` Example response: ``` json { "success": true, "data": { "filename": "invoice_file313fd5f32f1bba535e6adf73e7ad045f.pdf", "file_size": 113016 } } ``` Response fields - `success` boolean Indicates whether the upload succeeded. - `data.filename` string Server-generated stored filename. - `data.file_size` number Size of the uploaded file in bytes.