Setting invoice number and prefix through API

Hello,

We are generating invoice through the prefix.

  1. Is it possible to send invoice number and prefix through the API?
    If yes, would you please share a sample request ?
  2. Also, what happens if that number is already taken? Doe sit automatcally increment to the next one?

Thank you

Hi,

  1. If you send the invoice number when creating the invoice then it’s used rather than prefix and counter. The web app uses the API, we suggest using the network tab in the browser console to view sample requests.

  2. If the number is already taken the API will fail to create the invoice.

I made a mistake in my question. I am using self-hosted v4.
Would you please answer based on this?

Thanks

This is the same for v4 and v5

Thanks, though in browser console, not able to see API request as it is v4.

Yes, that’s correct.

Thanks. Is it possible to share a sample request where invoice number/prefix is sent in the API to generate the invoice?

You can see an example here of creating an invoice using the v4 API. The app doesn’t support setting the prefix but you can set the number.

https://invoice-ninja.readthedocs.io/en/latest/api.html#creating-data