# Bulk jobs

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

| Operation | Method and path | Scope |
|---|---|---|
| [Export the product file](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-product-export) | `POST /jobs/product-exports` | [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read) |
| [Start a product import](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-product-import) | `POST /jobs/product-imports` | [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage) |
| [Check an uploaded product file](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-product-import-check) | `POST /jobs/product-imports/{id}/check` | [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage) |
| [Apply a checked import](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-apply) | `POST /jobs/{id}/apply` | [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage) |
| [Poll a job](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-get) | `GET /jobs/{id}` | [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read) |
| [Download a job's file](https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs#jobs-download) | `GET /jobs/{id}/download` | [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read) |

## Export the product file {#jobs-product-export}

`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.

- **Operation:** `jobs.product_export`
- **Scope:** [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read), or [`products:write`](https://docs.kaizenaflow.com/reference/scopes#products-write), which reads too
- **Answers:** `201`, made: the answer under `data`.
- **Once only:** with an [`Idempotency-Key`](https://docs.kaizenaflow.com/reference/admin-api#idempotency) header.

### Body {#jobs-product-export-body}

JSON, with `Content-Type: application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `options` | map of string to any | no, default `{}` | The export's choices as the Data page sends them (which products, the file's dialect); everything when left out. |

### Answer {#jobs-product-export-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.job` | object or null | A job to poll, for a file of more than 2,000 rows; null when the file is answered here. |
| `data.job.id` | string (uuid) |   |
| `data.job.kind` | one of `product_export`, `product_import` |   |
| `data.job.status` | one of `uploaded`, `checking`, `checked`, `queued`, `running`, `done`, `failed`, `cancelled`, `expired` | An import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done. |
| `data.job.rows_total` | integer or null |   |
| `data.job.rows_done` | integer or null |   |
| `data.job.counts` | map of string to any | What 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.problem` | string or null |   |
| `data.job.files` | integer | Parts of an export's file, ready to download. |
| `data.job.created_at` | string (date-time) |   |
| `data.job.finished_at` | string (date-time) or null |   |
| `data.job.expires_at` | string (date-time) or null | When an export's files are deleted. |
| `data.file` | object or null |   |
| `data.file.name` | string |   |
| `data.file.content_type` | `"text/csv"` |   |
| `data.file.csv` | string |   |
| `data.file.rows` | integer |   |

### Errors {#jobs-product-export-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 409 | [`conflict`](https://docs.kaizenaflow.com/reference/errors#conflict) | Nothing 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. |
| 422 | [`invalid`](https://docs.kaizenaflow.com/reference/errors#invalid) | Nothing 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. |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-product-export-example}

**curl**

```shell
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**

```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**

```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 {#jobs-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`.

- **Operation:** `jobs.product_import`
- **Scope:** [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage)
- **Answers:** `201`, made: the answer under `data`.
- **Once only:** with an [`Idempotency-Key`](https://docs.kaizenaflow.com/reference/admin-api#idempotency) header.

### Body {#jobs-product-import-body}

JSON, with `Content-Type: application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `file_name` | string, 1 to 200 characters | yes | The file's name, such as products.csv. |

### Answer {#jobs-product-import-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.upload_id` | string (uuid) |   |
| `data.upload_url` | string or null | A 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.headers` | map of string to string |   |

### Errors {#jobs-product-import-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 409 | [`conflict`](https://docs.kaizenaflow.com/reference/errors#conflict) | Nothing 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. |
| 422 | [`invalid`](https://docs.kaizenaflow.com/reference/errors#invalid) | Nothing 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. |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-product-import-example}

**curl**

```shell
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**

```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**

```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 {#jobs-product-import-check}

`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.

- **Operation:** `jobs.product_import_check`
- **Scope:** [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage)
- **Answers:** `201`, made: the answer under `data`.
- **Once only:** with an [`Idempotency-Key`](https://docs.kaizenaflow.com/reference/admin-api#idempotency) header.

### Path parameters {#jobs-product-import-check-path}

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | yes | The upload's id. |

### Body {#jobs-product-import-check-body}

JSON, with `Content-Type: application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `file_name` | string, 1 to 200 characters | yes | The same name the upload was started with. |
| `options` | map of string to any | no, default `{}` | The import's choices as the Data page sends them. |

### Answer {#jobs-product-import-check-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.kind` | one of `product_export`, `product_import` |   |
| `data.status` | one of `uploaded`, `checking`, `checked`, `queued`, `running`, `done`, `failed`, `cancelled`, `expired` | An import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done. |
| `data.rows_total` | integer or null |   |
| `data.rows_done` | integer or null |   |
| `data.counts` | map of string to any | What 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.problem` | string or null |   |
| `data.files` | integer | Parts of an export's file, ready to download. |
| `data.created_at` | string (date-time) |   |
| `data.finished_at` | string (date-time) or null |   |
| `data.expires_at` | string (date-time) or null | When an export's files are deleted. |

### Errors {#jobs-product-import-check-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 404 | [`not_found`](https://docs.kaizenaflow.com/reference/errors#not-found) | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | [`conflict`](https://docs.kaizenaflow.com/reference/errors#conflict) | Nothing 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. |
| 422 | [`invalid`](https://docs.kaizenaflow.com/reference/errors#invalid) | Nothing 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. |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-product-import-check-example}

**curl**

```shell
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**

```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**

```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 {#jobs-apply}

`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.

- **Operation:** `jobs.apply`
- **Scope:** [`products:manage`](https://docs.kaizenaflow.com/reference/scopes#products-manage)
- **Answers:** `200`, the answer under `data`.
- **Once only:** with an [`Idempotency-Key`](https://docs.kaizenaflow.com/reference/admin-api#idempotency) header.

### Path parameters {#jobs-apply-path}

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | yes | The thing's id in this store. |

### Body {#jobs-apply-body}

JSON, with `Content-Type: application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `body` | object | yes | Nothing: send `{}` or no body. |

### Answer {#jobs-apply-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.kind` | one of `product_export`, `product_import` |   |
| `data.status` | one of `uploaded`, `checking`, `checked`, `queued`, `running`, `done`, `failed`, `cancelled`, `expired` | An import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done. |
| `data.rows_total` | integer or null |   |
| `data.rows_done` | integer or null |   |
| `data.counts` | map of string to any | What 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.problem` | string or null |   |
| `data.files` | integer | Parts of an export's file, ready to download. |
| `data.created_at` | string (date-time) |   |
| `data.finished_at` | string (date-time) or null |   |
| `data.expires_at` | string (date-time) or null | When an export's files are deleted. |

### Errors {#jobs-apply-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 403 | [`gated`](https://docs.kaizenaflow.com/reference/errors#gated) | The 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. |
| 404 | [`not_found`](https://docs.kaizenaflow.com/reference/errors#not-found) | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | [`conflict`](https://docs.kaizenaflow.com/reference/errors#conflict) | Nothing 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. |
| 422 | [`invalid`](https://docs.kaizenaflow.com/reference/errors#invalid) | Nothing 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. |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-apply-example}

**curl**

```shell
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**

```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**

```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 {#jobs-get}

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

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

- **Operation:** `jobs.get`
- **Scope:** [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read), or [`products:write`](https://docs.kaizenaflow.com/reference/scopes#products-write), which reads too
- **Answers:** `200`, the answer under `data`.

### Path parameters {#jobs-get-path}

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | yes | The thing's id in this store. |

### Answer {#jobs-get-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.kind` | one of `product_export`, `product_import` |   |
| `data.status` | one of `uploaded`, `checking`, `checked`, `queued`, `running`, `done`, `failed`, `cancelled`, `expired` | An import: uploaded, checking, checked (its dry run's counts), running, done. An export: queued, running, done. |
| `data.rows_total` | integer or null |   |
| `data.rows_done` | integer or null |   |
| `data.counts` | map of string to any | What 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.problem` | string or null |   |
| `data.files` | integer | Parts of an export's file, ready to download. |
| `data.created_at` | string (date-time) |   |
| `data.finished_at` | string (date-time) or null |   |
| `data.expires_at` | string (date-time) or null | When an export's files are deleted. |

### Errors {#jobs-get-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 404 | [`not_found`](https://docs.kaizenaflow.com/reference/errors#not-found) | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-get-example}

**curl**

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

**JavaScript**

```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**

```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 {#jobs-download}

`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.

- **Operation:** `jobs.download`
- **Scope:** [`products:read`](https://docs.kaizenaflow.com/reference/scopes#products-read), or [`products:write`](https://docs.kaizenaflow.com/reference/scopes#products-write), which reads too
- **Answers:** `200`, the answer under `data`.

### Path parameters {#jobs-download-path}

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string (uuid) | yes | The thing's id in this store. |

### Answer {#jobs-download-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.parts` | list of objects |   |
| `data.parts[].name` | string |   |
| `data.parts[].url` | string |   |
| `data.problems_csv` | string or null |   |

### Errors {#jobs-download-errors}

| Status | Code | When |
|---|---|---|
| 401 | [`unauthorized`](https://docs.kaizenaflow.com/reference/errors#unauthorized) | No valid token in `Authorization: Bearer kf_…`, or one that was revoked. |
| 403 | [`forbidden`](https://docs.kaizenaflow.com/reference/errors#forbidden) | The 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. |
| 404 | [`not_found`](https://docs.kaizenaflow.com/reference/errors#not-found) | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | [`conflict`](https://docs.kaizenaflow.com/reference/errors#conflict) | Nothing 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. |
| 429 | [`rate_limited`](https://docs.kaizenaflow.com/reference/errors#rate-limited) | More calls than the budget allows; `Retry-After` says how many seconds to wait. |
| 500 | [`failed`](https://docs.kaizenaflow.com/reference/errors#failed) | Something went wrong on our side; nothing more was done. It is safe to try again. |

### Example request {#jobs-download-example}

**curl**

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

**JavaScript**

```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**

```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)
```

---

https://docs.kaizenaflow.com/reference/admin-api/bulk-jobs · made from the API contract 1.57
