Invoice ninja: Download PDF invoice

I’ve sucessfully connected n8n to my self hosted Invoice ninja instance. I’ve been using Zapier to download PDF files. To access the file, you need to provide the url and an invite key, for example: invoiceninja.com/invite/hmlqsdlra3ihj1plcfkj1hcoxk1hseiw. This url downloads the PDF file without logging in.

Does anyone know how to achieve the same with n8n? I’ve used the correct node, but it does not return the invite key.

tldr: how do I download a PDF file from invoice ninja?

Welcome to the community @legion

According to the docs, you can do a GET to /download/{invoiceId} with the invoice ID to download it. Sadly, the node does not support such functionality, but you can use the HTTP node instead.

curl -X GET ninja.dev/api/v1/download/1 -H "X-Ninja-Token: TOKEN"

2 Likes

wow, thank you so much!
i’d never have figured that out myself. hopefully someone else will also benefit from your solution.

Hi,

Thanks for sharing a solution. I tried to do this on a v5, self-hosted version of Invoice Ninja.

I replaced
"X-Ninja-Token: TOKEN"
with
"X-Api-Token: TOKEN"
for v5 (this Header Auth works fine in other workflows), but here I get an error 404

I tried HTTP request with URL:
https://mydomain.tld/api/v1/download/[inv_number]

Am I doing something wrong?

Thanks in advance,

For those who are interested, I solved my problem with the invitation key:

https://mydomain.tld/api/v1/invoice/[invitation-key]/download
with header
X-Api-Token: TOKEN

In order to automate it, I have a webhook that gets me invoice info when it is updated, and I get the [invitation-key] from there.

n8n and Invoice Nija are just fantastic, thanks to everyone :star_struck:

4 Likes

Welcome to the community @steph

Good to hear that you figured it out.

Thanks for sharing the solution with the community

1 Like