V5 vs v4 Creating Invoice via API

Hi there,

Before migrating to v5, I want to make sure that the API works the same to understand if we need to edit anything in our backend.

In v4, the api call to create an invoice looked something like this

curl -X POST "ninja.test/api/v1/invoices" -H "Content-Type:application/json" \
  -d '{"client_id":"1", "invoice_items":[{"product_key": "ITEM", "notes":"Test", "cost":10, "qty":1}]}' \
  -H "X-Ninja-Token: TOKEN"

In the v5 docs, I’m not seeing anything on “creating an invoice” there is documentation on “adding an invoice” but it doesn’t show an example with any data in it

Can you verify if the call to create invoice is the same in v4 and v5? Headers and all?

Hi,

You can find info on the changes here:

https://invoiceninja.github.io/docs/developer-guide/#migrating-from-v4

Some of the field names have changed, I suggest using a GET request to load a sample invoice.

Thank you! these docs are very helpful