Imports
An Import bulk-loads catalog data from a file rather than one API call per record. Each import targets an import type - the kind of data being loaded, such as product, collections or suppliers - which defines the columns the file is expected to carry and the metadata it accepts.
An import is a job: the upload is synchronous, but processing is asynchronous. The job starts pending, moves to processing, then ends completed or failed, and its report gives the per-row result once processing is done.
The Import object
Section titled “The Import object”| Property | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@context | string | object | - | |||||||||||||||||||||||||||||||||||||||||||||
@id | string | required | |||||||||||||||||||||||||||||||||||||||||||||
@type | string | required | |||||||||||||||||||||||||||||||||||||||||||||
createdAt | string | null | - | |||||||||||||||||||||||||||||||||||||||||||||
format | "csv" | "tsv" | "xlsx" | null | - | |||||||||||||||||||||||||||||||||||||||||||||
id | string | - | |||||||||||||||||||||||||||||||||||||||||||||
metadata | object | - | |||||||||||||||||||||||||||||||||||||||||||||
report | object | null | - | Per-row processing report. Null until the import has been processed. | ||||||||||||||||||||||||||||||||||||||||||||
Show | |||||||||||||||||||||||||||||||||||||||||||||||
| Property | Type | Required | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error | string | - | Present only when the import failed systemically. | ||||||||||||
errors | object[] | required | |||||||||||||
Show | |||||||||||||||
| Property | Type | Required | Description |
|---|---|---|---|
line | integer | required | |
messages | string[] | required |
failedintegerimportedintegerresetobjecttotalRowsintegerstatus"pending" | "processing" | "completed" | "failed" | nulltype"collections" | "categories" | "attributes" | "suppliers" | "attribute_options" | "purchase_offer" | "sale_offer" | "metafield_value" | "product" | nullupdatedAtstring | nullHow it fits together
Section titled “How it fits together”- Pick the type. List import types to see the supported types and the
metadataeach accepts (such as thelocale, or the XLSXsheetName). - Prepare the file. In the
unstableversion, download an example file for the type rather than guessing the column layout. - Upload it. Create an import with the
file, itstypeand anymetadata, asmultipart/form-data. - Follow the job. Retrieve the import until its
statusiscompletedorfailed, then read itsreport:totalRows,imported,failed, and theerrorsof each rejected line.
Start from an example
Section titled “Start from an example”The example download is only available in the unstable version. It returns a ready-to-fill file for a given type, in csv (default) or xlsx, and serves two different needs through its mode:
sample(default) - a small, hand-crafted illustrative file showing the expected columns and a few example rows. Useful to discover the format.data- a full, re-importable export of your existing tenant data for that type. Useful to bulk-edit what you already have and load it back.
The two modes differ in what they require: sample needs only imports:read, while data also needs the read permissions of the target domain - for the product type, products:read or products:org:read plus medias:read.
Conventions
Section titled “Conventions”Authentication and headers
Section titled “Authentication and headers”All requests require an OAuth 2.0 bearer token:
Authorization: Bearer <token>Reading imports requires the imports:read scope; creating one also requires imports:write.