Invoices are not downloding trough API

Hi All,
I’m trying to download invoice PDF file trough API, but always I get a HTML file with 140kb size.

I can create invoices (curl -X POST …)
I can list invoices (curl -X GET …)

But when I try to download an invoice (curl -X GET the only thing I get, is a HTML file where is written “Oops something goes wrong”. Without any error anywhere.

I’ve found on your on your Github issues a suggestion, that I get download PDF with GET request and invitation code, eg:{invitation_key}

I have tried, but downloaded file is a corrupt PDF file with same 140kb size.
In the same time the URL with invitation to view invoices works fine ({invitation_key})

Can you please, suggest me any idea ?


Can you check storage/logs/laravel-error.log for details about the error.

Hi Hillel Coren,

Yes, I have something like this
"[2016-08-12 20:24:36] production.ERROR: exception ‘Symfony\Component\Debug\Exception\FatalErrorException’ with message ‘Call to undefined function Illuminate\View\Compilers\token_get_all()’ in /var/www/ninja/bootstrap/cache/compiled.php:15485 Stack trace: #0 {main} [] []

Maybe this will help…

Sorry my mistake, this is an error from time when I have installed the ninja.
I cleared laravel-error.log, I tried again, no success and no errors.

Any another idea ?

Not sure… if you see ‘something went wrong’ there should be a message in the logs.

Can you also check you web server error logs.

There is no error on my Apache too, and this is normal because I get HTTP 200 response, but the content is wrong.
And why another API are working, and only this download is broken ?

I have tried to download the pdf from{invitation_key}, but my knowledge of JS is not so good, so the problem is still active.


I think I may see the problem. We use to generate the PDF, for this to work your app needs to be publicly accessible.