How to create an Invoice
Creating an Invoice is very simple.
You first call the Create endpoint which creates the Invoice in the draft state. An Invoice in the draft state is still not valid. It needs to be finalized, with the Change State endpoint, to be a valid Invoice to send to your clients and to Autoridade Tributária (AT), if your company is in Portugal.
The advantage of having a draft state is that you can either delete the Invoice, with the Change State endpoint, or you can Update the Invoice and change it's data before finalizing it. After finalizing the Invoice, you cannot change the data anymore.
But what if you finalize an Invoice and realized there was a mistake? No problem, you can still cancel the Invoice, with the Change State endpoint. Canceled Invoices need to be communicated to AT but you won't send them to your clients.
Once the Invoice is in the finalized state and your customer pays the Invoice, you can settle the Invoice, with the Change State endpoint. This distinguishes Invoices that haven't been paid from already paid Invoices.
So let's recap the main states of an Invoice:
The other types of documents (Estimates, Guides and Purchase Orders) have similiar states.