Start an import draft
Creates a draft for one data kind, without changing the store; the merchant imports it from the review page after submission. Read GET /imports/guide first, then add rows with POST /imports/{id}/rows. Reuse the first draft’s batch_id for the same migration and put the merchant’s agreed decisions in settled.
Required access
- API key
- Any ofChange the catalogCreate and change customersManage purchase ordersCreate and change quotesChange ordersWork warranty claimspermissions
- Request limit
- Counts as 1 request. Each key has a capacity of 15, restored at 0.6 a second.
Idempotent-Replayed: true. Responses are saved for 24 hours.Headers
Bearer and your key, opk_….
Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.
application/json. A body is at most 256 KB.
Body
JSONThe batch_id of one of this key’s sends, to add these drafts to it (the merchant reviews them together). Left out: a new send.
true: check each draft with rows once they are in (it answers checking). Left out: check it later with POST /imports/{id}/check.
The rows as CSV text, in place of rows: the file’s header row, then its rows (commas, semicolons or tabs). A header names a column by its header, key or alias, ignoring case and spaces, as an upload does; a column the kind doesn’t use is named in a note. 500 rows a call in all.
The kind of data: products (Shopify products), product_templates, options, categories, customers, vendors, stock (stock on hand), quotes, orders, purchase_orders or warranty_claims. One kind’s draft; for several at once, send kinds instead.
One of products, product_templates, options, categories, customers, vendors, stock, quotes, orders, purchase_orders, warranty_claims.
Several kinds at once, in place of kind: by kind, each with the rows or csv, last, settled and open a one-kind create takes ({ "vendors": { "rows": [...] }, "categories": { "csv": "..." } }). They are one send: there is no batch_id to pass on. The answer is the first draft in review order, and drafts lists each.
As on POST /imports/{id}/rows: these are all the rows. A new draft has no rows after them, so it changes nothing here.
What you still ask the merchant about this data, as POST /imports/{id}/questions takes it: each { text, rows }, the rows it is about (left out: the whole file).
The rows it is about (the first is 2).
The question as you ask it in the chat.
Rows, in order: row 2 first (row 1 is the header). 500 rows a call in all.
What you and the merchant settled in the chat about this data, up to 50 points, each title and answer up to 1,000 characters. The review page lists them read-only by title, so the merchant isn’t asked again.
What was settled, as one plain sentence: “Leave the 16 missing line prices blank for the merchant to fill in.”
A short title for the point, a few words: “Missing prices”, “Currency”. Settling the same title again replaces its answer.
Returns
Created: batch_id, counts, created_at, created_by, drafts, existing_choice, expires_at, failure, id, import_mode and more
Errors
Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.
The request isn’t valid (see error.code), or the API version isn’t supported.
No valid access token or API key.
The store’s subscription isn’t active.
Not allowed: the API is off for this store, or the caller lacks the scope or permission.
Not found, or not visible to this caller.
Wrong method for this path; Allow lists every method the path takes.
The request body didn’t arrive in time.
The same Idempotency-Key is still being processed (REQUEST_IN_PROGRESS), its outcome is unknown (OUTCOME_UNKNOWN: check the record), or the record changed since it was read.
The request body is too large.
The request is valid JSON but can’t be done (a rule of the store refuses it), or the Idempotency-Key was used with a different body.
The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.
Over a rate limit; wait Retry-After seconds.
Something went wrong on our side. A write may have partly happened: check the record before retrying it.
Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.