# Content

> Content types and their entries (D326).

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

## List content types {#content-types}

`GET https://kaizenaflow.com/api/admin/v1/content-types`

The store's content types (D326) in their order, each with its fields.

- **Operation:** `content.types`
- **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`.

### Answer {#content-types-answer}

| Field | Type | Description |
|---|---|---|
| `data` | list of objects |   |
| `data[].id` | string (uuid) |   |
| `data[].key` | string |   |
| `data[].name` | string |   |
| `data[].slug` | string |   |
| `data[].fields` | list of any | The type's fields as its page defines them. |
| `data[].has_pages` | boolean | Its entries have pages of their own on the site. |
| `data[].entries` | integer |   |

### Errors {#content-types-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. |
| 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 {#content-types-example}

**curl**

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

**JavaScript**

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

## List a type's entries {#content-entries}

`GET https://kaizenaflow.com/api/admin/v1/content-types/{id}/entries`

A content type's entries in the owner's order, each with its draft.

- **Operation:** `content.entries`
- **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 {#content-entries-path}

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

### Query parameters {#content-entries-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 {#content-entries-answer}

| Field | Type | Description |
|---|---|---|
| `data` | list of objects |   |
| `data[].id` | string (uuid) |   |
| `data[].type_id` | string (uuid) |   |
| `data[].slug` | string |   |
| `data[].state` | one of `draft`, `published`, `changed` |   |
| `data[].draft` | map of string to any | The entry's draft: its fields' values (`data`) and its search texts. |
| `data[].published_at` | string (date-time) or null |   |
| `data[].updated_at` | string (date-time) |   |

### Errors {#content-entries-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). |
| 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 {#content-entries-example}

**curl**

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

**JavaScript**

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

## Get an entry {#content-entry}

`GET https://kaizenaflow.com/api/admin/v1/content-entries/{id}`

One entry with its draft.

- **Operation:** `content.entry`
- **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 {#content-entry-path}

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

### Answer {#content-entry-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.type_id` | string (uuid) |   |
| `data.slug` | string |   |
| `data.state` | one of `draft`, `published`, `changed` |   |
| `data.draft` | map of string to any | The entry's draft: its fields' values (`data`) and its search texts. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |

### Errors {#content-entry-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 {#content-entry-example}

**curl**

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

**JavaScript**

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

## Create an entry {#content-entry-create}

`POST https://kaizenaflow.com/api/admin/v1/content-types/{id}/entries`

Makes an entry of the type as a draft, its values checked by the type's fields as the entry page checks them.

- **Operation:** `content.entry_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.

### Path parameters {#content-entry-create-path}

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

### Body {#content-entry-create-body}

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

| Field | Type | Required | Description |
|---|---|---|---|
| `slug` | string, at most 120 characters | yes | Its address: lowercase letters, digits and single hyphens. |
| `fields` | map of string to any | no, default `{}` | The change as the entry page sends it: `values` by field id, and `translations` per language of the fields written in words; a field left out stays. Checked by the type's fields as the page checks them. |
| `seo` | object | no |   |
| `seo.title` | string, at most 200 characters | yes |   |
| `seo.description` | string, at most 400 characters | yes |   |

### Answer {#content-entry-create-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.type_id` | string (uuid) |   |
| `data.slug` | string |   |
| `data.state` | one of `draft`, `published`, `changed` |   |
| `data.draft` | map of string to any | The entry's draft: its fields' values (`data`) and its search texts. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |

### Errors {#content-entry-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. |
| 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 {#content-entry-create-example}

**curl**

```shell
curl -X POST 'https://kaizenaflow.com/api/admin/v1/content-types/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/entries' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"slug":"your-store"}'
```

**JavaScript**

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

**Python**

```python
import json
import os
import urllib.request

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

## Save an entry's draft {#content-entry-update}

`PATCH https://kaizenaflow.com/api/admin/v1/content-entries/{id}`

Changes the entry's draft: the values given, laid over its draft as kept. Its address is not drafted: a published entry's changes on the site at once, so it takes the power `content:publish` too (else `gated`).

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

### Path parameters {#content-entry-update-path}

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

### Body {#content-entry-update-body}

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

| Field | Type | Required | Description |
|---|---|---|---|
| `slug` | string, at most 120 characters | no | Its address: lowercase letters, digits and single hyphens. |
| `fields` | map of string to any | no, default `{}` | The change as the entry page sends it: `values` by field id, and `translations` per language of the fields written in words; a field left out stays. Checked by the type's fields as the page checks them. |
| `seo` | object | no |   |
| `seo.title` | string, at most 200 characters | yes |   |
| `seo.description` | string, at most 400 characters | yes |   |

### Answer {#content-entry-update-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.type_id` | string (uuid) |   |
| `data.slug` | string |   |
| `data.state` | one of `draft`, `published`, `changed` |   |
| `data.draft` | map of string to any | The entry's draft: its fields' values (`data`) and its search texts. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |

### Errors {#content-entry-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 {#content-entry-update-example}

**curl**

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

**JavaScript**

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

**Python**

```python
import json
import os
import urllib.request

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

## Publish an entry {#content-entry-publish}

`POST https://kaizenaflow.com/api/admin/v1/content-entries/{id}/publish`

Publishes the entry's draft: it needs a title and its type's required fields.

- **Operation:** `content.entry_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 {#content-entry-publish-path}

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

### Body {#content-entry-publish-body}

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

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

### Answer {#content-entry-publish-answer}

| Field | Type | Description |
|---|---|---|
| `data` | object |   |
| `data.id` | string (uuid) |   |
| `data.type_id` | string (uuid) |   |
| `data.slug` | string |   |
| `data.state` | one of `draft`, `published`, `changed` |   |
| `data.draft` | map of string to any | The entry's draft: its fields' values (`data`) and its search texts. |
| `data.published_at` | string (date-time) or null |   |
| `data.updated_at` | string (date-time) |   |

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

**curl**

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

**JavaScript**

```javascript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/content-entries/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/publish", {
  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/content-entries/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/publish",
    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)
```

---

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