# Post category assignment

Each post has zero or one publication-scoped category. Set or clear the
category with `/post/save`; public category routes show only active categories
that have eligible public posts.

## Authentication

`POST /post/save` requires a bearer token with `post.save` in the selected
publication.

## Request field

| Field | Required | Type | Description |
| --- | --- | --- | --- |
| `category_id` | No | UUID or `null` | Category from the post's publication. Omit to retain the existing category; use `null` or an empty value to clear it. |

```json
{
  "post_id": "POST_UUID",
  "category_id": "CATEGORY_UUID"
}
```

The category must exist in the post's publication. An invalid UUID returns
`400`; a missing or cross-publication category returns `404`.

`/post/get`, `/post/list`, and post-save responses return `category_id`.
Public responses return a compact public category instead:

```json
{
  "category": {
    "slug": "release-notes",
    "name": "Release notes"
  }
}
```

If the category's `active` value is `false`, it and every post assigned to it
are excluded from public read routes. A category cannot be deleted while posts
still reference it; move or clear those post assignments first.
