Create and Submit Sales Invoice via REST API v11

Hi Guys

I’ve been trying without any luck to create and submit a Sales Invoice via the REST API.
All the invoices I manage to create end up in “Draft” state and I need to submit them from the ERPNext interface.
I’m using Postman for testing.

I’m doing a POST to /api/resource/Sales Invoice and setting all the fields I can to valid values.
I’m setting submit_on_creation to 1 (not “1”)
I’ve tried including a payments array too.

  1. Is it possible to create and submit a Sales Invoice from the REST API in v11?
  2. Do I have to include a payment or can I create an Unpaid Sales Invoice that does not end up in “Draft”?

Does someone have an example JSON body that will :

  • create an unpaid non-POS sales invoice
  • have the invoice automatically submitted
  • not have any payments associated with it

Thanks

1 Like

Hi Guys

I’ve been searching the forums before this post but as I was reading the “related posts” links I found the solution.
Looks like the missing attribute was “docstatus”:1

Added that to my JSON body and it now creates and submits with the Sales Invoice ending up in Unpaid state.

Thanks

1 Like