Help with API Put request - invoice_id not updating

Hi,

I have the expenses in the system and the api works fine to create it and update it, i can PUT a client_id, but i cant add the invoice_id,

This is my put request data {“id”:709,“invoice_id”:726,“should_be_invoiced”:false,“client_id”:2}

This is my response - I can get the client_id to change, however the invoice_id never changes. Is there a function i am missing?

[19-03-10 11:18:32:164 EDT] {data={invoice_currency_id=1, private_notes=Office 2016, client_id=2, is_deleted=false, updated_at=1552231112, expense_currency_id=1, public_notes=Office 2016, bank_id=0, invoice_id=0, id=709, transaction_reference=, should_be_invoiced=false, transaction_id=61d95399-c841-4fd3-8f0d-eef3f749fec9, amount=26.93, exchange_rate=1, archived_at=null, is_owner=true, account_key=0Kexci07TR5teakzuPRGjzdIFg0dNmNg, expense_date=2019-02-10, tax_name1=, tax_name2=, tax_rate1=0.000, tax_rate2=0.000, custom_value2=, custom_value1=, vendor_id=23, expense_category_id=7}}
[19-03-10 11:18:32:165 EDT] 709.0

The only way to set the invoice_id for an expense is to invoice the expense.

I believe it’s possible with the API by setting the expense_id on the invoice line item.