# Blog

> The store's blog articles (D57, D341), as pages are.

| Operation | Method and path | Scope |
|---|---|---|
| [List blog articles](https://docs.kaizenaflow.com/reference/admin-api/blog#articles-list) | `GET /articles` | [`content:read`](https://docs.kaizenaflow.com/reference/scopes#content-read) |
| [Get a blog article](https://docs.kaizenaflow.com/reference/admin-api/blog#articles-get) | `GET /articles/{id}` | [`content:read`](https://docs.kaizenaflow.com/reference/scopes#content-read) |
| [Create a draft blog article](https://docs.kaizenaflow.com/reference/admin-api/blog#articles-create) | `POST /articles` | [`content:write`](https://docs.kaizenaflow.com/reference/scopes#content-write) |
| [Save a blog article's draft](https://docs.kaizenaflow.com/reference/admin-api/blog#articles-update) | `PATCH /articles/{id}` | [`content:write`](https://docs.kaizenaflow.com/reference/scopes#content-write) |
| [Publish a blog article](https://docs.kaizenaflow.com/reference/admin-api/blog#articles-publish) | `POST /articles/{id}/publish` | [`content:publish`](https://docs.kaizenaflow.com/reference/scopes#content-publish) |

## List blog articles {#articles-list}

`GET https://kaizenaflow.com/api/admin/v1/articles`

The store's blog articles, the most recently changed first, each with whether its draft is published.

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

### Query parameters {#articles-list-query}

| Name | Type | Required | Description |
|---|---|---|---|
| `updated_after` | string (date-time) | no | Only what was made or changed after this time (ISO 8601 with its offset), for incremental sync. |

### Answer {#articles-list-answer}

| Field | Type | Description |
|---|---|---|
| `data` | list of objects |   |
| `data[].id` | string (uuid) |   |
| `data[].title` | string |   |
| `data[].slug` | string | Its address on the site, after the store's (a page) or blog/ (an article). |
| `data[].state` | one of `draft`, `published`, `changed` | draft: never published. published: the site shows the draft as it is. changed: the draft has changes not published. |
| `data[].published_at` | string (date-time) or null |   |
| `data[].updated_at` | string (date-time) |   |

### Errors {#articles-list-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. |
| 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 {#articles-list-example}

**curl**

```shell
curl 'https://kaizenaflow.com/api/admin/v1/articles' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"
```

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/articles", {
  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/articles",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)
```

## Get a blog article {#articles-get}

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

One blog article with its draft as the editor keeps it.

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

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

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

### Answer {#articles-get-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.title` | string |   |
| `data.slug` | string | Its address on the site, after the store's (a page) or blog/ (an article). |
| `data.state` | one of `draft`, `published`, `changed` | draft: never published. published: the site shows the draft as it is. changed: the draft has changes not published. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |
| `data.draft` | map of string to any | The page as the editor keeps it (its words, rows and blocks, search texts, categories): what `PATCH` takes back whole. |

### Errors {#articles-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 {#articles-get-example}

**curl**

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

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/articles/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/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)
```

## Create a draft blog article {#articles-create}

`POST https://kaizenaflow.com/api/admin/v1/articles`

Makes a blog article as a draft through the editor's own save and its checks; nothing is on the site until it is published. A draft that carries `globalEdits` is refused: global parts change in the admin.

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

### Body {#articles-create-body}

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

| Field | Type | Required | Description |
|---|---|---|---|
| `draft` | map of string to any | yes | The page as the editor keeps it, whole (read one with GET first); the editor's own checks run on it. It is saved as the draft; the site keeps what was published. |

### Answer {#articles-create-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.title` | string |   |
| `data.slug` | string | Its address on the site, after the store's (a page) or blog/ (an article). |
| `data.state` | one of `draft`, `published`, `changed` | draft: never published. published: the site shows the draft as it is. changed: the draft has changes not published. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |
| `data.draft` | map of string to any | The page as the editor keeps it (its words, rows and blocks, search texts, categories): what `PATCH` takes back whole. |

### Errors {#articles-create-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 {#articles-create-example}

**curl**

```shell
curl -X POST 'https://kaizenaflow.com/api/admin/v1/articles' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"draft":{"example":"example"}}'
```

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/articles", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "draft": {
      "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/articles",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "draft": {
            "example": "example",
        },
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)
```

## Save a blog article's draft {#articles-update}

`PATCH https://kaizenaflow.com/api/admin/v1/articles/{id}`

Saves the blog article's draft whole through the editor's save; what the site shows stays as published until it is published again. A draft that carries `globalEdits` is refused: global parts, and the pages using them, change in the admin.

- **Operation:** `articles.update`
- **Scope:** [`content:write`](https://docs.kaizenaflow.com/reference/scopes#content-write)
- **Answers:** `200`, the answer under `data`.

### Path parameters {#articles-update-path}

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

### Body {#articles-update-body}

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

| Field | Type | Required | Description |
|---|---|---|---|
| `draft` | map of string to any | yes | The page as the editor keeps it, whole (read one with GET first); the editor's own checks run on it. It is saved as the draft; the site keeps what was published. |

### Answer {#articles-update-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.title` | string |   |
| `data.slug` | string | Its address on the site, after the store's (a page) or blog/ (an article). |
| `data.state` | one of `draft`, `published`, `changed` | draft: never published. published: the site shows the draft as it is. changed: the draft has changes not published. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |
| `data.draft` | map of string to any | The page as the editor keeps it (its words, rows and blocks, search texts, categories): what `PATCH` takes back whole. |

### Errors {#articles-update-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). |
| 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 {#articles-update-example}

**curl**

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

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "draft": {
      "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/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
    method="PATCH",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "draft": {
            "example": "example",
        },
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)
```

## Publish a blog article {#articles-publish}

`POST https://kaizenaflow.com/api/admin/v1/articles/{id}/publish`

Publishes the blog article's draft through the editor's own publish: its checks run, and a blocking issue not acknowledged is refused as `conflict` naming it.

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

### Path parameters {#articles-publish-path}

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

### Body {#articles-publish-body}

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

| Field | Type | Required | Description |
|---|---|---|---|
| `acknowledged_issues` | list of string, at most 200 characters, at most 100 items | no | The checker's blocking issues (their ids) the owner has seen and publishes with; a publish with an issue not named is refused as `conflict` with the issues. |

### Answer {#articles-publish-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.title` | string |   |
| `data.slug` | string | Its address on the site, after the store's (a page) or blog/ (an article). |
| `data.state` | one of `draft`, `published`, `changed` | draft: never published. published: the site shows the draft as it is. changed: the draft has changes not published. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |
| `data.draft` | map of string to any | The page as the editor keeps it (its words, rows and blocks, search texts, categories): what `PATCH` takes back whole. |

### Errors {#articles-publish-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 {#articles-publish-example}

**curl**

```shell
curl -X POST 'https://kaizenaflow.com/api/admin/v1/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/publish' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"acknowledged_issues":["example"]}'
```

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/publish", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "acknowledged_issues": [
      "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/articles/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/publish",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "acknowledged_issues": [
            "example",
        ],
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)
```

---

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