Invoice via e-mail and/or downloadable pdf invoices via your API

So the thing is I’m trying to automate our invoicing, and I’m having trouble with your invoices, and if it’s to much trouble for you to send them via e-mail you could make the pdf’s available via the API or similar with the regular auth headers.

So I have written this script, where I can find the latest receipt and grab the receipt_id but it troubles me to download it via the API

If you have an URL with AUTH headers available that way i can set up an automated flow where when i get a notice from you guys with a new invoice i could go grab the latest and send it to our accounting department