Upload Attachment
You can use this endpoint to upload an attachment for a receipt.
Request
PUT /api/v1/receipts/:id/attachments
curl --request PUT \
--url 'https://www.zep-online.de/zepinstanz/next/api/v1/receipts/123/attachments' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"filename": "receipt_2024_11_15.pdf",
"file_contents": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFI+PgplbmRvYmoKMiAwIG9iago8PC9UeXBlL1BhZ2VzL0NvdW50IDEvS2lkc1szIDAgUl0+PgplbmRvYmoKMyAwIG9iago8PC9UeXBlL1BhZ2UvTWVkaWFCb3hbMCAwIDYxMiA3OTJdL1BhcmVudCAyIDAgUj4+CmVuZG9iago..."
}'Required Fields
The following fields are required when uploading an attachment:
- filename (string): The name of the file being uploaded
- file_contents (string): Base64-encoded file contents
Parameters
- id (integer, required): The ID of the receipt to which the attachment will be added
Response
Successful Upload
{
"success": true
}A successful upload returns an object with success: true.
Error Codes
- 401 Unauthorized: Invalid or missing authentication
- 404 Not Found: Receipt with the specified ID was not found
- 500 Internal Server Error: Upload failed
Notes
- File contents must be encoded in Base64 format
- Make sure the file size does not exceed the system's allowed limits
- Supported file formats should be verified before uploading
- The
filenameshould include a valid file extension (e.g.,.pdf,.jpg,.png)
Example with Base64 Encoding
Encode File to Base64 (Bash)
base64 -i receipt.pdfComplete Example
PUT /api/v1/receipts/123/attachments{
"filename": "invoice_november.pdf",
"file_contents": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFI+PgplbmRvYmoKMiAwIG9iago8PC9UeXBlL1BhZ2VzL0NvdW50IDEvS2lkc1szIDAgUl0+PgplbmRvYmoKMyAwIG9iago8PC9UeXBlL1BhZ2UvTWVkaWFCb3hbMCAwIDYxMiA3OTJdL1BhcmVudCAyIDAgUj4+CmVuZG9iago..."
}Response:
{
"success": true
}