> ## Documentation Index
> Fetch the complete documentation index at: https://www.twicecommerce.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to migrate your data through the API

> Move a TWICE 1.0 account's locations, stock, catalog, prices and customers into TWICE 2.0 through the Admin API, in the order the data depends on.

> [card] [Open in TWICE Admin](https://admin.twicecommerce.com/settings/connect/integrations)
>
> settings/connect/integrations

Read the 1.0 account through its API and write it into 2.0 through the [Admin API](https://www.twicecommerce.com/docs/concepts/integrations/overview.md), one stage at a time. Each step names what the stage must get right, and where to see the result in the admin. [What changes from TWICE 1.0](https://www.twicecommerce.com/docs/guides/migration/what-changes-from-1-0.md) maps every 1.0 object to its 2.0 counterpart.

Leave orders in 1.0. An imported order gets a new number and date, and reserves stock across your calendar.

## Prerequisites

> [!WARNING]
>
> **Required permissions:** **Integrations & API** to create the key (`account_settings:integrations`). Owner and Admin hold it. See [Users & Roles](https://www.twicecommerce.com/docs/settings/users-roles.md).

> [!NOTE]
>
> **Have ready before you start:**
>
> * **Settings configured** in [step 1](https://www.twicecommerce.com/docs/guides/migration/configure-settings.md): your locations, currency and tax setting exist before any data does.
> * **A TWICE 1.0 API key** for the account. Ask your TWICE contact if you do not have one.
> * **Four decisions, made with the merchant:**
>   * **Locations:** one per 1.0 store, or several stores merged into one location.
>   * **Prices:** each 1.0 duration tier as a fixed row, or one rate-based row.
>   * **Customers:** migrate them, or leave them in 1.0. They are personal data.
>   * **Tax:** whether 1.0 prices include tax, read from a real 1.0 order.

## The walkthrough

**1. Create the 2.0 API key**

Open **Settings → Integrations & API** and click **Create key** on **API keys**. Name it, then under **Access** pick **Limited access** and set **Inventory**, **Catalog** and **Locations** to **Write**, plus **Customers** and **Online store** if you migrate those. Copy the key from **Store your API key**: it is shown once.

![The Create API key dialog on its Access step, with the step, Limited access and the Inventory and Catalog rows at Write highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-01.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=7fac6cd8f68d613c596d9f4ea2bef8c5)

**2. Check the 2.0 account is empty**

Open **Catalog → Listings** and **Inventory → Stock items** in the 2.0 admin. Both tables should be empty. If they hold listings or stock items, the account has been migrated or built before: stop and find out by whom before you write anything. Save a copy of both accounts' data now, as the point to return to.

![The Listings table with no rows, highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-02.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=48d5af77169512d52c0bcb471fc8e106)

**3. Map each 1.0 store to a 2.0 location**

Open **Settings → Locations** and note each location under **All locations**, then read their IDs through the API. Point every 1.0 store at the location it becomes, merged stores included. Write stock, listings and prices against these IDs. Leave the locations' own setup to step 1: a location with no pickup or return method, or no sales channel, makes nothing orderable.

![Settings open on Locations, with the All locations card highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-03.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=26759c78d615bb016dfdb3bb7afc9c84)

**4. Create the SKUs and stock items**

Create one SKU per 1.0 SKU, with the same code. Create a 1.0 single article as a stock item tracked individually, and a bulk article as one stock item tracked by quantity. Mark sold or lost articles inactive. Create the attributes first, and carry custom field values onto them.

![The SKUs table, with the SKUs nav item and the SKU Code column highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-04.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=ae3122e988fa4217d9af0d3ee951f9ef)

**5. Create the listings**

Create one listing per 1.0 product. Skip duplicates the merchant made as a 1.0 workaround. Copy each product's sales channels, including products hidden from the online store. Convert Markdown descriptions to rich text, or the storefront shows the raw symbols.

![A listing's Publishing tab, with the tab and the Sales channels card highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-05.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=112bae6b851d9119c47f44024b89759c)

**6. Write the inventory rules**

Give each listing a rule that matches its SKU codes. Give a package one rule per component, each for one unit: conditions inside one rule match any of them, separate rules must all be met. For sizes and other variants, create the options, then one variant rule per option that narrows to that option's stock.

![A package listing's Fulfilment tab, with the tab and the Stock items card with one rule per component highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-06.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=275e8a1268c1917c08cd8c3644dd1028)

**7. Create the price tables**

Write each 1.0 tier as a fixed row, or one rate-based row, as decided. A 1.0 day counted within opening hours becomes a day row capped to closing time. Check the price scale first: some 1.0 accounts store prices in cents. A row valid on every weekday leaves weekdays unset, never an empty list.

![A listing's Pricing tab, with the tab and the price rows highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-07.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=1a67066165d0cdc6a50fae98930a7400)

**8. Create the add-ons**

Make free accessories add-on listings and attach each to the listings it goes with, unless everything the merchant offers is free. Create insurance or a damage waiver as a cart add-on.

![A listing's Recommendations tab, with the tab and the Add-ons card highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-08.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=f55bb48fdb78e8c0067c8c51647f6145)

**9. Create the collections**

Create one collection per 1.0 category the merchant still uses, and add its listings. Turn the online channel off on a collection with no online listing in it, or it shows empty in the storefront menu.

![The Collections table, highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-09.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=22398f5412958f9259d9a20460c37e45)

**10. Import the customers, if you decided to**

Create one customer per 1.0 customer, and match on email to avoid duplicates. Skip this step if the merchant chose to leave customers in 1.0.

![The Customers table with its rows blurred, highlighted](https://mintcdn.com/twicecommerce/jz2_BOK5KskFTNx1/images/guide-migrate-through-the-api-10.webp?fit=max\&auto=format\&n=jz2_BOK5KskFTNx1\&q=85\&s=6e12d9061031b849d08f409af5bb58e8)

## How do I know it worked?

* Every 1.0 SKU, stock item, product and category the merchant kept has a 2.0 counterpart, counted against the totals each API reports.
* Every listing with stock behind it has an inventory rule, and its price rows match 1.0.
* The merchant has run [step 3](https://www.twicecommerce.com/docs/guides/migration/check-what-was-migrated.md), and every listing can be ordered on the storefront.

## Troubleshooting / common pitfalls

> [accordion] Every listing shows as unavailable on the storefront
>
> A location has no pickup or return method or its online channel is off, or the price rows are valid on no weekday. See [Diagnose an unsellable listing](https://www.twicecommerce.com/docs/guides/catalog/diagnose-an-unsellable-listing.md).

> [accordion] Prices are a hundred times too high or too low
>
> This 1.0 account stores prices in a different unit from the one you assumed. Compare one migrated price with what the merchant charges today, then rerun the price stage. See [What changes from TWICE 1.0](https://www.twicecommerce.com/docs/guides/migration/what-changes-from-1-0.md#your-prices).

> [accordion] A package can be ordered when one component is out of stock
>
> Its components share one rule, so any one of them satisfies it. Split them into one rule each. See [Listing inventory rules](https://www.twicecommerce.com/docs/guides/catalog/listing-inventory-rules.md).

## Related articles

> [card] [What changes from TWICE 1.0](https://www.twicecommerce.com/docs/guides/migration/what-changes-from-1-0.md)
>
> Every 1.0 object and what replaces it in 2.0.

> [card] [API keys](https://www.twicecommerce.com/docs/concepts/integrations/api-keys.md)
>
> Scopes, expiry and how to send a key.

> [card] [Bulk creation](https://www.twicecommerce.com/docs/concepts/integrations/bulk-creation.md)
>
> Create many stock items, SKUs or customers in one call.

> [card] [Check your data against 1.0](https://www.twicecommerce.com/docs/guides/migration/check-what-was-migrated.md)
>
> The merchant's check once the import is done.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.