Import Containers

Import Containers are the entry point for Import API requests and serve as data containers for importing resources.

Each create, update, or patch request sent to the Import API is first accumulated in an Import Container and then asynchronously imported into commercetools Composable Commerce. For more information on using Import Containers effectively for your requirements, see best practices.
A maximum of 1 000 Import Containers can be created per Project. Learn more about this limit here.

Representations

ImportContainer

Serves as the entry point of resources. An Import Container is not resource type-specific.

version
Int

The version of the ImportContainer.

key
String

User-defined unique identifier for the ImportContainer.

resourceType
The resource type the ImportContainer is able to handle. If not present, the ImportContainer is able to import all of the supported ImportResourceTypes.
retentionPolicyBETA

The retention policy of the ImportContainer.

expiresAtBETA
DateTime
Date and time (UTC) the ImportContainer is automatically deleted. Only present if a retentionPolicy is set. ImportContainers without expiresAt are permanent until manually deleted.
createdAt
DateTime

Date and time (UTC) the ImportContainer was initially created.

lastModifiedAt
DateTime

Date and time (UTC) the ImportContainer was last updated.

Example: json
{
  "key": "my-import-container",
  "version": 1,
  "createdAt": "2018-02-05T09:47:16.648Z",
  "lastModifiedAt": "2018-02-05T09:47:16.649Z"
}

ImportContainerDraft

The representation sent to the server when creating an ImportContainer.
key
String

User-defined unique identifier of the ImportContainer.

Pattern^[a-zA-Z0-9_-]+$
resourceType
The resource type to be imported. If not given, the ImportContainer is able to import all of the supported ImportResourceTypes.
retentionPolicyBETA

Set a retention policy to automatically delete the ImportContainer after a defined period.

Example: json
{
  "key": "my-import-container"
}

ImportContainerPagedResponse

PagedQueryResult for ImportContainers. Used as a response to a query request for ImportContainers.
limit
Int
Default20Minimum0Maximum500
offset
Int
Number of elements skipped.
Default0Maximum10000
count
Int

The actual number of results returned.

total
Int

The total number of results matching the query.

results
Array of ImportContainer

The array of Import Containers matching the query.

Example: json
{
  "limit": 20,
  "offset": 0,
  "count": 1,
  "total": 1,
  "results": [
    {
      "key": "my-import-container",
      "version": 1,
      "createdAt": "2018-02-05T09:47:16.648Z",
      "lastModifiedAt": "2018-02-05T09:47:16.649Z"
    }
  ]
}

ImportContainerUpdateDraft

The representation sent to the server when updating an Import Container.

version
Int

Current version of the ImportContainer.

resourceType
The resource type to be imported. If not given, the ImportContainer is able to import all of the supported ImportResourceTypes.
Example: json
{
  "version": 1,
  "resourceType": "product"
}

ImportResourceType

The resource types that can be imported.

category
The Category import resource type.
customer
The Customer import resource type.
inventory
The Inventory import resource type.
order
The Order import resource type.
order-patch
The Order patch import resource type.
price
The Embedded Price import resource type.
product
The Product import resource type.
product-draft
The Product draft import resource type.
product-type
The Product Type import resource type.
product-variant
The Product Variant import resource type.
product-variant-patch
The Product Variant patch resource type.
standalone-price
The Standalone Price import resource type.
type
The Type import resource type.
discount-code
The Discount Code import resource type.

RetentionPolicy BETA

Abstract parent type for retention policies, distinguished by the strategy field.

TimeToLiveRetentionPolicy BETA

Set a time to live retention policy for the ImportContainer.

strategy
StrategyEnum
ttl

The strategy of the retention policy. Used to determine how the ImportContainer should be retained.

config

The configuration of the time to live retention policy.

TimeToLiveConfig BETA

timeToLive
String
The time to live of the ImportContainer. Used to generate the expiresAt value of the ImportContainer. The lowest accepted value is 1h and the highest accepted value is 30d.
Pattern^(?:(d+)d|(d+)h|(d+)m)$

Get ImportContainer

GET
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}

Retrieves the Import Container given by the key.

OAuth 2.0 Scopes:
manage_import_containers:{projectKey}view_import_containers:{projectKey}
Path parameters:
region
String
The Region in which the Project is hosted.
projectKey
String

The Project key.

importContainerKey
String

The key of the Import Container.

Response:
200

ImportContainer

asapplication/json
Request Example:cURL
curl --get https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" 
200 Response Example: ImportContainerjson
{
  "key": "my-import-container",
  "version": 1,
  "createdAt": "2018-02-05T09:47:16.648Z",
  "lastModifiedAt": "2018-02-05T09:47:16.649Z"
}

Query ImportContainers

GET
https://import.{region}.commercetools.com/{projectKey}/import-containers

Retrieves all Import Containers of a given project key.

OAuth 2.0 Scopes:
manage_import_containers:{projectKey}view_import_containers:{projectKey}
Path parameters:
region
String
The Region in which the Project is hosted.
projectKey
String

The Project key.

Query parameters:
sort
String
See Sorting.
The parameter can be passed multiple times.
limit
Int
Default: 20
Minimum: 0
Maximum: 500
offset
Int
Number of elements skipped.
Default: 0
Maximum: 10000
Response:
200

ImportContainerPagedResponse

asapplication/json
Request Example:cURL
curl --get https://import.{region}.commercetools.com/{projectKey}/import-containers -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
200 Response Example: ImportContainerPagedResponsejson
{
  "limit": 20,
  "offset": 0,
  "count": 1,
  "total": 1,
  "results": [
    {
      "key": "my-import-container",
      "version": 1,
      "createdAt": "2018-02-05T09:47:16.648Z",
      "lastModifiedAt": "2018-02-05T09:47:16.649Z"
    }
  ]
}

Create ImportContainer

POST
https://import.{region}.commercetools.com/{projectKey}/import-containers

Creates a new Import Container.

Generates the ImportContainerCreated Event.
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String
The Region in which the Project is hosted.
projectKey
String

The Project key.

Request Body:ImportContainerDraftasapplication/json
Response:
201

ImportContainer

asapplication/json
Request Example:cURL
curl https://import.{region}.commercetools.com/{projectKey}/import-containers -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA 
{
  "key" : "my-import-container"
}
DATA
201 Response Example: ImportContainerjson
{
  "key": "my-import-container",
  "version": 1,
  "createdAt": "2018-02-05T09:47:16.648Z",
  "lastModifiedAt": "2018-02-05T09:47:16.649Z"
}

Update ImportContainer

PUT
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}

Updates the Import Container given by the key.

OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String
The Region in which the Project is hosted.
projectKey
String

The Project key.

importContainerKey
String

The key of the Import Container.

Request Body:ImportContainerUpdateDraftasapplication/json
Response:
200

ImportContainer

asapplication/json
Request Example:cURL
curl -X PUT https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA 
{
  "version" : 1,
  "resourceType" : "product"
}
DATA
200 Response Example: ImportContainerjson
{
  "version": 2,
  "resourceType": "product",
  "key": "my-import-container",
  "createdAt": "2018-02-05T09:47:16.648Z",
  "lastModifiedAt": "2025-01-05T12:22:20.649Z"
}

Delete ImportContainer

DELETE
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}
Deletes the Import Container specified by the importContainerKey.
Generates the ImportContainerDeleted Event.
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String
The Region in which the Project is hosted.
projectKey
String

The Project key.

importContainerKey
String

The key of the Import Container.

Response:
200

ImportContainer

asapplication/json
Request Example:cURL
curl -X DELETE https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
200 Response Example: ImportContainerjson
{
  "key": "my-import-container",
  "version": 1,
  "createdAt": "2018-02-05T09:47:16.648Z",
  "lastModifiedAt": "2018-02-05T09:47:16.649Z"
}