Hey
@thisishel
In order to update the "SentToContact" field of an invoice in Xero's API, the invoice must be in the "AUTHORISED" status. This means that the invoice has been approved and is ready to be sent to the contact.
If you want to update the "SentToContact" field of a draft invoice, you will need to first change the status of the invoice to "AUTHORISED". You can do this by using the "Status" field in the API request and setting it to "AUTHORISED".
Once the invoice has been set to "AUTHORISED", you can then update the "SentToContact" field as needed by setting it to "true" or "false".
It's worth noting that once an invoice has been set to "AUTHORISED", it cannot be changed back to "DRAFT". If you need to make further changes to the invoice, you will need to create a new draft invoice and make the changes there. So try again with a unique invoice number and details.
I hope this helps!