Change contact on invoice via api

Hi there,

Over the years, we’ve ended up with 20,000 duplicate contacts in Freeagent (don’t ask!) so we’re now doing a big clean up exercise.

Anyhow, I’d like to use the api to change the contact for Invoice A from Contact X_1 to Contact X_2.
Once Contact X_1 has no invoices associated with it, I can delete it, leaving only Contact X_2.

From what I can tell in the documentation, the api may not support changing an invoice’s contact. Is that right?

Thanks,
Bruno

What we’ve found with Fabio is, the API can change an Invoice’s contact, but the Invoice must be in a DRAFT state, otherwise the following error is returned:

contact_id is locked and cannot be changed

Ah, thank you. That means we’re going to have to also use the api to remove the bank transaction explanation, make it draft, change the contact, mark as sent and reapply the bank transaction explanation. Ooof!

1 Like

Hi Bruno,

That’s right, once an invoice has been sent then the contact cannot be changed - only when it’s a draft. There isn’t functionality to merge contacts at present, but I’ve added a vote to our feature request for it.

There are common circumstances where you wouldn’t be able to edit old invoices or remove bank transaction explanations either, e.g. where tax returns have been filed for the same period, so it may not be possible to do this in full.

We’d generally suggest that the older duplicate contacts are marked as hidden (status attribute: docs) so they’re not shown in the FreeAgent interface, but I appreciate that this doesn’t solve the issue fully.

Kind regards,
Dominic