How can I change programmatically invoice status_id, last_sent_date?

Hello,

I moved to control emails sending manually, since your templates renderer give me incorrect rendering error.
However, I faced to another issue - how to update invoice status_id and last_sent_date fields?

I’ve tried to use PUT /api/invoices/id endpoint , but it does not update these fields.
Please advise!

Hi,

Those fields are read only, the status id is changed when the invoice is sent or paid.

How do we mark invoice sent since we send it ourselves?
We send it ourselves because the template does not render properly using invoice ninja

You can use the /bulk route to send the mark_sent action.

You can use the network tab in the browser console to see the requests made by the app.

It gives me a hope…

Although, I do not see /bulk request.
Could you please provide a sample for the described acion ‘mark_sent’ above ?

If you mark an invoice as sent in the app from the invoice table/list you should see the bulk request.

1 Like

Thank you!

There is no action “mark as sent” . I’ve found “mark as paid” and used the same syntax.
It seems works, but when I marked it as paid , I can’t mark invoice back as sent, is it correct ?

POST v1/invoices/bulk

{
	"ids": [
		"<id>"
	],
	"action": "mark_sent"
}

Also, have another question about web hooks, related to this question.
Will this /bulk request initiate update invoice web hook ?

@david can you please advise?

@akushyn

Yes the bulk route also will trigger webhooks.

just to note, we also have the query parameter ?mark_sent=true which enables marking an invoice as sent.

1 Like

@david @hillel

How can I do the same to mark as canceled invoice ?
What the action name?

Found - it is “cancel” action.
The reason it does not work, I guess, because I tested with “draft” invoice, but invoice has to be sent.

1 Like