---
search:
  tags:
    - Categories
    - PUT
seo:
  description: >-
    Admin and inventory manager. Renames a category and optionally moves it to
    a… Reference for the PUT /api/v1/categories/{slug} endpoint in the
    PharmaFlow API.
sidebar:
  label: Update a category
  badge: PUT
title: Update a category
type: openapi-operation
---
Admin and inventory manager. Renames a category and optionally moves it to a new slug. A changed slug cascades onto every medicine under it, and a slug or name clash is refused.

`PUT /api/v1/categories/{slug}`

**Request body** (`application/json`, required)

- `name` (string)
- `slug` (string)

Request body example:

```json
{
  "name": "string",
  "slug": "string"
}
```

**Responses**

- `200` — Category updated
- `400` — The body is invalid, nothing is supplied to update, or the slug has no letters or digits
- `401` — Not authenticated
- `403` — Caller is not an admin, inventory manager, or branch manager
- `404` — Category not found
- `409` — A category with that slug or name already exists

Response example, 200:

```json
{
  "slug": "string",
  "name": "string",
  "medicine_count": -9007199254740991
}
```
