Skip to content

Import products or stock from a file

POST
/api/v1/workspaces/{workspaceId}/product-imports
curl --request POST \
--url https://api.crossmart.io/api/v1/workspaces/example/product-imports \
--header 'Content-Type: multipart/form-data' \
--form format=shopify_csv \
--form mode=create \
--form file=binary

In create mode, products whose handle is already in the catalog are skipped, never overwritten. In update mode, products are found by handle and only the columns in the file change: a missing column keeps its value, an empty cell clears it. Variants are matched by SKU, then by option values, and are never deleted; stock is left as it is. In inventory mode, a sku,available CSV sets the stock of tracked variants. Invalid records are reported; the rest are applied. Every import is recorded in the import history. Product modes need products:edit, inventory needs inventory:edit.

workspaceId
required
string
Media typemultipart/form-data
object
format
required
string
Allowed values: shopify_csv inventory_csv shopify_api
mode

create adds new products (Shopify CSV), update replaces products matched by handle (Shopify CSV) and inventory sets stock by SKU (inventory CSV)

string
Allowed values: create update inventory create_or_link
file
required

The catalog file

string format: binary
Media typeapplication/json
object
jobId
required

The import history entry of this import

string format: uuid
mode
required
string
Allowed values: create update inventory create_or_link
createdProducts
required
number
createdVariants
required
number
updatedProducts
required

Products replaced by an update import

number
updatedVariants
required

Variants whose stock an inventory import set

number
skipped
required

Records left as they were: already in the catalog, not found, stock not tracked

Array<object>
object
code
required
string
Allowed values: already_exists duplicate_sku invalid_value missing_value invalid_options not_found unknown_sku not_tracked duplicate_row unmatched_variant already_linked
message
required
string
handle
string
sku
string
row

Spreadsheet row number; the header is row 1

number
failed
required

Records that could not be imported

Array<object>
object
code
required
string
Allowed values: already_exists duplicate_sku invalid_value missing_value invalid_options not_found unknown_sku not_tracked duplicate_row unmatched_variant already_linked
message
required
string
handle
string
sku
string
row

Spreadsheet row number; the header is row 1

number

Example

{
"mode": "create",
"skipped": [
{
"code": "already_exists"
}
],
"failed": [
{
"code": "already_exists"
}
]
}