Adding document to Invoice using API call in Make/Integromat

I’m using Make/Integromat to automate creating multiple invoices by reading a list of invoice data from a CSV which works well.
However I also need to attach a file to the invoices. This is not possible using the built-in Invoice Ninja Make Modules that create invoice.

So instead I using the generic Make API Call to call the Update Invoice end point to attach the file. I just can’t get it to work. The API call is returning a 200 success, but no files are being added to the Documents of the invoice.

Here is the basic syntax I’m using.
I’m using the “Invoice ID” from the create invoice module which works fine, and I’m using the raw “Data” from the file download from Google Drive module for the file to upload to the Documents array of the invoice.

Is what I’m doing possible, using the raw data from Google file download as the file?
Is my syntax correct?
Any guidance much appreciated.


In order to make this work, you’ll need to add in a few extra fields.

For example if you are trying to attach a document to an existing Invoice, you’ll need to use the PUT route

curl -X POST \
 http://ninja.test:8000/api/v1/invoices/kQBeXWdyK8 \
 -H 'Content-Type: multipart/form-data'\
 -H 'X-API-TOKEN: api-key' \
 -H 'X-Requested-With: XMLHttpRequest' \
 -F file[]=@/home/david/Desktop/1.jpeg \
 -F name=1.jpg \
 -F _method=PUT

However there is a quirk in REST which doesn’t allow files to be uploaded when using the verb PUT, so you need to POST the request, and nest a parameter _method with a value of PUT

This will allow you to upload documents to any resource in Invoice Ninja.

Thanks David for the quick reply.

I get what you said, but I have not been successful trying to implement that within the Make interface.
I used documents[] array instead of files, because that’s what the Upload API states, but I did also try using file[]
Not sure if you have used Make before, maybe my syntax is wrong.
I tried putting it in the body but got 404 error.

Then I also tried separating it into the Query strings. That seemed to work better, but I got a different 422 error, it didn’t like my DATA as a file.
The operation failed with an error. [422] The given data was invalid. “file”: The file must be a file.; The file must be a file of type: csv, png, ai, jpeg, tiff, pdf, gif, psd, txt, doc, xls, ppt, xlsx, docx, pptx.