Using the API for export/import - will original ids work?

I’d like to use the API to export items from my account, then clear the account, then use the API to import the items back in. Would appreciate if you can tell me if this would work.

What I want to do broadly is:-

  1. Reset the account,

  2. Put in opening balances

  3. Bring in the existing contacts

  4. Bring in only invoices for the last financial year.

Now, I’ve had a look at the backed up excel spreadsheet that FreeAgent produces and I can’t see how I can use it because it doesn’t contain identifying IDs for the information.

So what I was thinking of doing was using the API. I’ve used in the past to create invoices and could see a way to do it.

  1. Use the API to select and export the contacts and invoices (including their id references) in JSON.

  2. Reset the account and put in opening balances.

  3. Use the API to import the contacts with the same IDs they had before.

  4. Use the API to import certain invoices (which have references to the contact IDs)

I need someone who understands the APIs to tell me if this would work, or if there would be a problem trying to use the same IDs.

Hi Iain,

The API doesn’t give you a way to create IDs for new items. In the API documentation, what you’re referring to as IDs are called URLs.

As an example, if you look at how to create an invoice, you’ll see you can pass a contact URLs into the invoice creation process , but you can’t specify what you want the ID of the new invoice to be.

If I understand your request, I think you could tweak your suggested process to make it work though.

  1. Use the API to select and export the contacts and invoices (including their id references) in JSON
  2. Reset the account and put in opening balances.
  3. Use the API to import the contacts, and pull down the new URLs/IDs as an extra field in your stored the JSON
  4. Use the API to import invoices with references to the contact URLs/IDs you want, referring to the new URLs when you’re importing them

Step 2 is clearly the dangerous step here, so I’d recommend getting a sandbox account to get the process to the point that you’re comfortable with it. If you haven’t already done this, the process is outlined in the quick start section of the docs.

I hope that helps, and good luck with it!

James