The Import API allows you to upload large amount of data to commercetools Composable Commerce.
The Import API performs asynchronous data import and automatically handles dependencies between resources. The arrows in the following diagram indicate the data flow.

Advantages of the Import API
The Import API provides the following advantages:
-
Asynchronous
You can send bulk data at once, and your systems can do something else while your data is imported asynchronously. -
Resource specific
You can separately import specific resources, including Products, Product Variants, and Prices. -
Automatic dependency handling
The Import API automatically handles data dependencies, such as the parental relations of Categories. -
API first
Unlike with CLI and UI tools, the Import API provides better opportunities for integration with modern application infrastructure.
Compare Import API with other HTTP APIs
You can create and update resources in your Composable Commerce Project using the Import API or other HTTP APIs. The following table explains the main differences between the APIs.
Functionality | Import API | HTTP APIs |
---|---|---|
Upload method | Asynchronous | Synchronous |
Updating resources | Including the key of an existing resource in your import request will update the resource with the specified values. | Different resource types have their own update actions. You must check what update actions to use and include them in an API call to a specific resource. |
Dependency handling | The Import API identifies and resolves dependencies between imported resources. | All dependencies must be considered beforehand. Dependent resources must be uploaded in the right order. |
Order of API calls | The order of API calls does not matter. The Import API waits for missing dependencies. Resources may not be imported in the order they were uploaded. | The order of API calls matters and operations arrive in the order they were imported. |
Status monitoring | You can actively query the status of the import process. | As this process happens synchronously, responses indicate either success or failure. You cannot query the status of the process. |
How to use the Import API
Identifiers
id
.id
values are unique within a single Project. This makes them unsuitable for managing data across multiple Projects (such as staging and production). In these scenarios, resource id
values will differ between Projects, whereas user-defined identifiers can be maintained consistently. Relying solely on user-defined identifiers therefore ensures predictable and reliable data imports across different Projects.key
to identify all resources, with the exception of OrderImport BETA and OrderPatchImport BETA which use orderNumber
.If a resource with the specified identifier exists when importing data, the Import API updates that resource with the imported data. If a resource with the specified identifier does not exist, the Import API creates a new resource.
ImportRequest
An ImportRequest is the data type that is sent in a request body to create or update resources in a Project.
20
resources to import. ImportRequests are resource-specific.- CategoryImportRequest BETA
- CustomerImportRequest BETA
- DiscountCodeImportRequest BETA
- EmbeddedPriceImportRequest BETA
- InventoryImportRequest BETA
- OrderImportRequest BETA
- OrderPatchImportRequest BETA
- ProductTypeImportRequest BETA
- ProductImportRequest BETA
- ProductDraftImportRequest BETA
- ProductVariantImportRequest BETA
- ProductVariantPatchRequest BETA
- StandalonePriceImportRequest BETA
- TypeImportRequest BETA
Generalities
Import API Workflow
The Import API employs the following workflow.

- Create an ImportContainer.
- Next, create an ImportRequest and post it to a resource-specific endpoint for import (for example, Import Categories). This initiates an import process.
- After sending the ImportRequest, the Import API returns an ImportResponse, the list of newly created ImportOperations and their validation statuses.
- During the import process, it is possible to get an aggregated summary (called an ImportSummary) of all the ImportOperations associated with a specific ImportContainer by calling Get ImportSummary.
- The Import API validates the import data structures and updates
state
of ImportOperations. For more information, see Processing State. - If the import is successful,
state
of the ImportOperations becomes"imported"
. The corresponding resource is now imported into the Project. - Suppose the ImportSummary shows that some ImportOperations ended up in the state
validationFailed
orrejected
. You can then see the error for each ImportOperation by querying them by the respective state.