Importing resources
How to bulk import resources and their relationships
Commerce Layer lets you import multiple resources in batches. To do that, you need to create a new import resource, specify the resource_type you want to import, and populate the inputs attribute with a JSON list of items. Each element of the inputs array contains the resource attributes and relationships.
The process is asynchronous and you can poll its status attribute to check the import progress. At the end of the import the processed_count attribute will indicate the number of imported items. In case of validation errors, the errors_count and errors_logattributes are populated.
Resource relationships can be specified by using their IDs. To do that, you need to append the _id suffix to the name of the related resource (e.g. price_list_id). Some relationships can also be specified as a nested array of objects (e.g. order line items).

Import limits

Maximum import size

Imports are subject to some soft limits: the inputs array must contain a maximum of 2000 items, otherwise the import will be rejected at creation time.

Maximum error percentage

During the importing phase, the errors count is also monitored: imports whom errors_count attribute overflows the maximum percentage of 10% of the total import size (i.e. the numbers of items contained in the inputs array) will be interrupted.

Concurrent imports

The maximum number of concurrent imports (i.e. imports whose status is pending or in_progess) allowed per organization is 10.

Supported resources

At moment, imports are available for the following resources (more to come):

Unique keys

If the single resource to be imported doesn't exist it gets created, otherwise it is updated.
In order to detect if a resource already exists the id key is checked for each inputs entry. Some resources also support specific (combined) attributes to identify an existing record, which can be helpful in case the resource ID isn't known during the import phase:
  • Bundles — code + market_id
  • Coupons — code + promotion_rule_id
  • Customer subscriptions — customer_id + reference
  • Customers — email
  • Gift cards — code
  • Orders — number
  • Prices — sku_code + price_list_id
  • SKU options — name + market_id
  • SKUs — code
  • Stock items — sku_code + stock_location_id
  • Tax categories — code + tax_calculator_id

Specifying the parent resource

If the resources you're importing refers to the same parent resource (e.g. prices to the same price list), you can avoid repeating its value on each inputs items by specifying the parent_resource_id attribute. In case you specify both the parent resource ID and the relationship ID for each item, the latter wins. These are the supported parent resources:
  • Bundles — market_id
  • Coupons — promotion_rule_id
  • Gift cards — market_id
  • Orders — market_id
  • Prices — price_list_id
  • SKU list items — sku_list_id
  • SKU options — market_id
  • Stock items — stock_location_id
  • Tax categories — tax_calculator_id

Cleaning-up records

Set the cleanup_records attribute as true if you want all the resources that are not present in the inputs list to be deleted at the end of the import. You can monitor the number of destroyed records once the import has been completed by inspecting the destroyed_count attribute.
Be careful when cleaning up records — this action is not reversible. The cleanup_records flag is better used in combination with the parent_resource_id attribute in order to reduce the scope of the destroyed records. If the parent resource ID is missing all of the not-imported resources for the organization will be affected by the cleanup, which might not be what you want.

Examples

Importing a list of bundles

Request
Response
The following request creates an import with a list of bundles:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "bundles",
11
"parent_resource_id": "bgOEQhznoZ",
12
"inputs": [
13
{
14
"code":"FWOUTFIT",
15
"name":"FW outfit",
16
"image_url":"https://img.yourdomain.com/bundles/FWOUTFIT.png",
17
"reference": "FWOUTFIT",
18
"sku_list_id": "GHYfrWszHp"
19
},
20
{
21
"code":"SSOUTFIT",
22
"name":"SS outfit",
23
"image_url":"https://img.yourdomain.com/bundles/SSOUTFIT.png",
24
"reference": "SSOUTFIT",
25
"sku_list_id": "GHYfrWszHp"
26
},
27
{...}
28
]
29
}
30
}
31
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "bundles",
8
"parent_resource_id": "bgOEQhznoZ",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
}
Copied!
For a list of all the required attributes you need to create a bundle, refer to the related section of the API reference.

Importing a list of coupons

Request
Response
The following request creates an import with a list of coupons and clean-up the ones existing for the same promotion rule:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "coupons",
11
"parent_resource_id": "FreQKlNxZA"
12
"cleanup_records": "true",
13
"inputs": [
14
{
15
"code": "XXXXXXXX",
16
"usage_limit": 10
17
},
18
{
19
"code": "YYYYYYYY",
20
"usage_limit": 5
21
},
22
{...}
23
]
24
}
25
}
26
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "coupons",
8
"parent_resource_id": "FreQKlNxZA",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": true,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
}
Copied!
Please note that in this case — since the cleanup_records attribute is set as true — all of the coupons for the specified promotion rule that aren't included in the inputs list will be destroyed.
For a list of all the required attributes you need to create a coupon, refer to the related section of the API reference.

Importing a list of customer subscriptions

Request
Response
The following request creates an import with a list of customer subscriptions:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "customer_subscriptions",
11
"inputs": [
12
{
13
"customer_email": "[email protected]",
14
"reference": "Marketing newsletter"
15
},
16
{
17
"customer_email": "[email protected]",
18
"reference": "Whitepaper download"
19
},
20
{...}
21
]
22
}
23
}
24
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "NqYzgIKvdm",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "customer_subscriptions",
8
"parent_resource_id": null,
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"errors_log": {},
20
"warnings_log": {},
21
"cleanup_records": false,
22
"created_at": "2018-01-01T12:00:00.000Z",
23
"updated_at": "2018-01-01T12:00:00.000Z",
24
"reference": null,
25
"reference_origin": null,
26
"metadata": {}
27
},
28
"meta": {
29
"mode": "test"
30
}
31
}
32
}
Copied!
For a list of all the required attributes you need to create a customer subscription, refer to the related section of the API reference.

Importing a list of customers

Request
Response
The following request creates an import with a list of customers:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "customers",
11
"inputs": [
12
{
13
"email": "[email protected]"
14
},
15
{
16
"email": "[email protected]",
17
"password": "secret",
18
"customer_group_id": "KngqdhAlpd"
19
},
20
{...}
21
]
22
}
23
}
24
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "ZqDQzIoznm",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "customers",
8
"parent_resource_id": null,
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"errors_log": {},
20
"warnings_log": {},
21
"cleanup_records": false,
22
"created_at": "2018-01-01T12:00:00.000Z",
23
"updated_at": "2018-01-01T12:00:00.000Z",
24
"reference": null,
25
"reference_origin": null,
26
"metadata": {}
27
},
28
"meta": {
29
"mode": "test"
30
}
31
}
32
}
Copied!
For a list of all the required attributes you need to create a customer, refer to the related section of the API reference.

Importing a list of gift cards

Request
Response
The following request creates an import with a list of gift cards:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "gift_cards",
11
"parent_resource_id": "bgOEQhznoZ",
12
"inputs": [
13
{
14
"balance_cents": 12500,
15
"currency_code": "USD",
16
"single_use": false,
17
"rechargeable": true,
18
"image_url": "https://img.yourdomain.com/skus/MYGITFCARDIMAGE.png",
19
"expires_at": "2030-01-01T00:00:00Z",
20
"recipient_email": "[email protected]"
21
},
22
{
23
"balance_cents": 20000,
24
"currency_code": "EUR",
25
"single_use": true,
26
"rechargeable": false,
27
"expires_at": "2025-01-01T00:00:00Z",
28
"recipient_email": "[email protected]"
29
},
30
{...}
31
]
32
}
33
}
34
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "BAzkwIRNkq",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "gift_cards",
8
"parent_resource_id": "bgOEQhznoZ",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"errors_log": {},
20
"warnings_log": {},
21
"cleanup_records": false,
22
"created_at": "2018-01-01T12:00:00.000Z",
23
"updated_at": "2018-01-01T12:00:00.000Z",
24
"reference": null,
25
"reference_origin": null,
26
"metadata": {}
27
},
28
"meta": {
29
"mode": "test"
30
}
31
}
32
}
Copied!
To create an import of gift cards for the same market, remember to specify its ID as theparent_resource_id attribute.
For a list of all the required attributes you need to create a gift card, refer to the related section of the API reference.

Importing a list of orders

Request
Response
The following request creates an import with a list of orders with associated line items and archives them at the same time:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "orders",
9
"attributes": {
10
"resource_type": "orders",
11
"parent_resource_id": "KmjljGJzWQ"
12
"inputs": [
13
{
14
"customer_email": "[email protected]",
15
"_archive": 1,
16
"line_items": [
17
{
18
"item_type": "sku",
19
"name": "BABYONBU000000E63E7424MX",
20
"quantity": 2,
21
"unit_amount_cents": 1000
22
},
23
{
24
"item_type": "sku",
25
"name": "BABYONBU000000E63E7418MX",
26
"quantity": 1,
27
"unit_amount_cents": 2000
28
}
29
]
30
},
31
{
32
"customer_email": "[email protected]",
33
"_archive": 1,
34
"line_items": [
35
{
36
"item_type": "sku",
37
"name": "BABYONBU000000E63E7667MX",
38
"quantity": 2,
39
"unit_amount_cents": 1500
40
}
41
]
42
},
43
{...}
44
]
45
}
46
}
47
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "orders",
8
"parent_resource_id": "KmjljGJzWQ",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"errors_log": {},
20
"warnings_log": {},
21
"cleanup_records": false,
22
"created_at": "2018-01-01T12:00:00.000Z",
23
"updated_at": "2018-01-01T12:00:00.000Z",
24
"reference": null,
25
"reference_origin": null,
26
"metadata": {}
27
},
28
"meta": {
29
"mode": "test"
30
}
31
}
Copied!
To create an import of orders for the same market, remember to specify its ID as the parent_resource_id attribute.
For a list of all the required attributes you need to create an order, refer to the related section of the API reference.

Importing a list of prices

Request
Response
The following request creates an import with a list of prices:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "prices",
11
"parent_resource_id": "vLrWRCJWBE",
12
"inputs": [
13
{
14
"sku_code": "BABYONBU000000E63E7424MX",
15
"amount_cents": 3990,
16
"compare_at_amount_cents": 5000
17
},
18
{
19
"sku_code": "BABYONBU000000E63E7418MX",
20
"amount_cents": 3490,
21
"compare_at_amount_cents": 4700
22
},
23
{...}
24
]
25
}
26
}
27
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "ZbDQzIoxnA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "prices",
8
"parent_resource_id": "vLrWRCJWBE",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
}
Copied!

Importing a list of prices with price tiers

Request
Response
The following request creates an import with a list of prices and the associated price tiers:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "prices",
11
"parent_resource_id": "vLrWRCJWBE",
12
"inputs": [
13
{
14
"sku_code": "BABYONBU000000E63E7424MX",
15
"amount_cents": 3990,
16
"compare_at_amount_cents": 5000,
17
"price_tiers": [
18
{
19
"type": "PriceVolumeTier",
20
"name": "3 pack",
21
"up_to": 3,
22
"price_amount_cents": 3500
23
},
24
{
25
"type": "PriceVolumeTier",
26
"name": "6 pack",
27
"up_to": 6,
28
"price_amount_cents": 3000
29
}
30
]
31
},
32
{
33
"sku_code": "BABYONBU000000E63E7418MX",
34
"amount_cents": 3490,
35
"compare_at_amount_cents": 4700
36
"price_tiers": [
37
{
38
"type": "PriceVolumeTier",
39
"name": "3 pack",
40
"up_to": 3,
41
"price_amount_cents": 3500
42
}
43
]
44
},
45
{...}
46
]
47
}
48
}
49
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "ZbDQzIoxnA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "prices",
8
"parent_resource_id": "vLrWRCJWBE",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
}
Copied!
To create an import of prices for the same price list, remember to specify its ID as the parent_resource_id attribute.
For a list of all the required attributes you need to create a price, refer to the related section of the API reference. More info about price volume tiers here.

Importing a list of SKU lists

Request
Response
The following request creates an import with a list of SKU lists with associated SKU list items at the same time:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "sku_lists",
11
"inputs": [
12
{
13
"name":"Promotional Items 15%",
14
"sku_list_items": [
15
{
16
"sku_code": "BABYONBU000000E63E7667MX",
17
},
18
{
19
"sku_code": "BABYONBU000000E63E7418MX",
20
}
21
]
22
},
23
{...}
24
]
25
}
26
}
27
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "sku_lists",
8
"parent_resource_id": null,
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
Copied!
For a list of all the required attributes you need to create an SKU list, refer to the related section of the API reference.

Importing a list of SKU list items

Request
Response
The following request creates an import with a list of SKU list items:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "sku_list_items",
11
"parent_resource_id": "XHnLEsQaZp",
12
"inputs": [
13
{
14
"sku_code": "BABYONBU000000E63E7667MX",
15
},
16
{
17
"sku_code": "BABYONBU000000E63E7418MX",
18
},
19
{...}
20
]
21
}
22
}
23
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "sku_lists",
8
"parent_resource_id": "XHnLEsQaZp",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
Copied!
For a list of all the required attributes you need to create an SKU list item, refer to the related section of the API reference.

Importing a list of SKU options

Request
Response
The following request creates an import with a list of SKU options:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "sku_options",
11
"parent_resource_id": "XHnLEsQaZp",
12
"inputs": [
13
{
14
"name": "engraving",
15
"price_amount_cents": 500,
16
"sku_code_regex": "^A"
17
},
18
{
19
"name": "shipping costs",
20
"price_amount_cents": 700,
21
"sku_code_regex": "^B"
22
},
23
{...}
24
]
25
}
26
}
27
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created import object with its status set to pending:
1
{
2
"data": {
3
"id": "PmjlkIJzRA",
4
"type": "imports",
5
"links": {...},
6
"attributes": {
7
"resource_type": "sku_options",
8
"parent_resource_id": "XHnLEsQaZp",
9
"status": "pending",
10
"started_at": null,
11
"completed_at": null,
12
"interrupted_at": null,
13
"inputs": [...],
14
"inputs_size": 100,
15
"errors_count": 0,
16
"warnings_count": 0,
17
"destroyed_count": 0,
18
"processed_count": 0,
19
"cleanup_records": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": null,
23
"reference_origin": null,
24
"metadata": {}
25
},
26
"meta": {
27
"mode": "test"
28
}
29
}
30
Copied!
For a list of all the required attributes you need to create an SKU option, refer to the related section of the API reference.

Importing a list of SKUs

Request
Response
The following request creates an import with a list of SKUs:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/imports' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "imports",
9
"attributes": {
10
"resource_type": "skus",
11
"inputs": [
12
{
13
"code":"BABYONBU000000E63E7424MX",
14
"name":"Black Baby Onesie Short Sleeve with Pink Logo (24 Months)",
15
"image_url":"https://img.yourdomain.com/skus/BABYONBU000000E63E74.png",
16
"reference": "BABYONBU000000E63E74",
17
"shipping_category_id": "zwzQeFBrNj"
18
},
19
{
20
"code":"BABYONBU000000E63E7418MX",
21
"name":"Black Baby Onesie Short Sleeve with Pink Logo (18 Months)",
22
"image_url":"https://img.yourdomain.com/skus/BABYONBU000000E63E74.png",
23
"reference": "BABYONBU000000E63E74",
24
"shipping_category_id": "zwzQeFBrNj"
25
},
26
{...}
27