Skip to content
Kaizena FlowDocs
Search

Search the docs

Bulk jobs

The product file of the Data page (D165): exported, and imported with a dry run first.

OperationMethod and pathScope
Export the product filePOST /jobs/product-exportsproducts:read
Start a product importPOST /jobs/product-importsproducts:manage
Check an uploaded product filePOST /jobs/product-imports/{id}/checkproducts:manage
Apply a checked importPOST /jobs/{id}/applyproducts:manage
Poll a jobGET /jobs/{id}products:read
Download a job's fileGET /jobs/{id}/downloadproducts:read

Export the product file

POST https://kaizenaflow.com/api/admin/v1/jobs/product-exports

The product CSV of the Data page (D165): answered here when it has at most 2,000 rows, else a job to poll and download.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
optionsmap of string to anyno, default {}The export's choices as the Data page sends them (which products, the file's dialect); everything when left out.

Answer

FieldTypeDescription
dataobject
data.jobobject or nullA job to poll, for a file of more than 2,000 rows; null when the file is answered here.
data.job.idstring (uuid)
data.job.kindone of product_export, product_import
data.job.statusone of uploaded, checking, checked, queued, running, done, failed, cancelled, expiredAn import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done.
data.job.rows_totalinteger or null
data.job.rows_doneinteger or null
data.job.countsmap of string to anyWhat the dry run found or the run did: products to make, to change, unchanged, refused. An import's dry has toCreate, toUpdate, unchanged, withProblems and onShop (products the apply would publish, archive, bring back or change on the site).
data.job.problemstring or null
data.job.filesintegerParts of an export's file, ready to download.
data.job.created_atstring (date-time)
data.job.finished_atstring (date-time) or null
data.job.expires_atstring (date-time) or nullWhen an export's files are deleted.
data.fileobject or null
data.file.namestring
data.file.content_type"text/csv"
data.file.csvstring
data.file.rowsinteger

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
422invalidNothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl -X POST 'https://kaizenaflow.com/api/admin/v1/jobs/product-exports' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"options":{"example":"example"}}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/product-exports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "options": {
      "example": "example"
    }
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/product-exports",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "options": {
            "example": "example",
        },
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Start a product import

POST https://kaizenaflow.com/api/admin/v1/jobs/product-imports

Gives a one-time address to PUT a product CSV (Kaizena Flow's, Shopify's or WooCommerce's) to; then check it with POST /jobs/product-imports/{id}/check.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
file_namestring, 1 to 200 charactersyesThe file's name, such as products.csv.

Answer

FieldTypeDescription
dataobject
data.upload_idstring (uuid)
data.upload_urlstring or nullA one-time address to PUT the file to. Answered once: a replay of the request (the same Idempotency-Key) answers null.
data.method"PUT"
data.headersmap of string to string

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
422invalidNothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl -X POST 'https://kaizenaflow.com/api/admin/v1/jobs/product-imports' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"file_name":"products.csv"}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/product-imports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "file_name": "products.csv"
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/product-imports",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "file_name": "products.csv",
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Check an uploaded product file

POST https://kaizenaflow.com/api/admin/v1/jobs/product-imports/{id}/check

Takes the file sent to the upload's address as an import job and runs its dry run, as the Data page does: poll the job until it is checked, then apply it. Its counts.dry.onShop is how many products the file would publish, archive, bring back or change on the site, which takes products:publish: without it, the check is of drafts only and refuses those products.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe upload's id.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
file_namestring, 1 to 200 charactersyesThe same name the upload was started with.
optionsmap of string to anyno, default {}The import's choices as the Data page sends them.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.kindone of product_export, product_import
data.statusone of uploaded, checking, checked, queued, running, done, failed, cancelled, expiredAn import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done.
data.rows_totalinteger or null
data.rows_doneinteger or null
data.countsmap of string to anyWhat the dry run found or the run did: products to make, to change, unchanged, refused. An import's dry has toCreate, toUpdate, unchanged, withProblems and onShop (products the apply would publish, archive, bring back or change on the site).
data.problemstring or null
data.filesintegerParts of an export's file, ready to download.
data.created_atstring (date-time)
data.finished_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen an export's files are deleted.

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
422invalidNothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl -X POST 'https://kaizenaflow.com/api/admin/v1/jobs/product-imports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/check' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"file_name":"example"}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/product-imports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/check", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "file_name": "example"
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/product-imports/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/check",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "file_name": "example",
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Apply a checked import

POST https://kaizenaflow.com/api/admin/v1/jobs/{id}/apply

Imports what the dry run found, through the product editor's own save; never deletes and never changes a handle. Without the power products:publish, an import whose dry run counted products to publish, archive, bring back or change on the site (counts.dry.onShop) is refused as gated and cancelled, and one checked by a token with the power (or in the admin) must be checked again; what is applied is drafts only, so a product that went on the site since the check is left as it is.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
bodyobjectyesNothing: send {} or no body.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.kindone of product_export, product_import
data.statusone of uploaded, checking, checked, queued, running, done, failed, cancelled, expiredAn import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done.
data.rows_totalinteger or null
data.rows_doneinteger or null
data.countsmap of string to anyWhat the dry run found or the run did: products to make, to change, unchanged, refused. An import's dry has toCreate, toUpdate, unchanged, withProblems and onShop (products the apply would publish, archive, bring back or change on the site).
data.problemstring or null
data.filesintegerParts of an export's file, ready to download.
data.created_atstring (date-time)
data.finished_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen an export's files are deleted.

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
403gatedThe request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
422invalidNothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl -X POST 'https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/apply' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/apply", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/apply",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({}).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Poll a job

GET https://kaizenaflow.com/api/admin/v1/jobs/{id}

A product file's job as it is now: its status, counts and parts.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.kindone of product_export, product_import
data.statusone of uploaded, checking, checked, queued, running, done, failed, cancelled, expiredAn import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done.
data.rows_totalinteger or null
data.rows_doneinteger or null
data.countsmap of string to anyWhat the dry run found or the run did: products to make, to change, unchanged, refused. An import's dry has toCreate, toUpdate, unchanged, withProblems and onShop (products the apply would publish, archive, bring back or change on the site).
data.problemstring or null
data.filesintegerParts of an export's file, ready to download.
data.created_atstring (date-time)
data.finished_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen an export's files are deleted.

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl 'https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
  },
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Download a job's file

GET https://kaizenaflow.com/api/admin/v1/jobs/{id}/download

A done export's file parts as short-lived addresses, or an import's problems as CSV.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.partslist of objects
data.parts[].namestring
data.parts[].urlstring
data.problems_csvstring or null

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403forbiddenThe token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl 'https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/download' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/download", {
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
  },
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/jobs/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/download",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Made from the API contract, version 1.57This page as Markdown

Was this page helpful?