Trouble with the new InvoiceNinja API

I was wondering if anyone had any examples of how to create a new tax rate, create a new client and how to make a new invoice via API?

I see the Swagger documentation here, but which parameters are required or optional and the format for each parameter is unclear.


The v5 app also uses the API. You can make the request in the app and use the network tab of the browser console to see the request.

I have tried replicating the API requests shown in the browser console but I get 500 errors :c

There should be more details about the 500 error in storage/logs.

Note: if the requests are working correctly in the app/browser the most likely cause is the request is different.


If you can show an example request we can help.

A sample request to create a tax rate with CURL is as follows:

curl -X POST 'http://ninja.test:8000/api/v1/tax_rates' \
-H "Content-Type:application/json" \
-d '{"name":"GST","rate":"10"}' \
-H "X-API-TOKEN:company-token-test" \
-H "X-Requested-With: XMLHttpRequest";

Pretty sure my issues are unrelated to the API, but rather caused by another issue. Will start a new thread about this!