---
search:
  tags:
    - Categories
    - POST
seo:
  description: >-
    Admin and inventory manager. Registers a category medicines can be filed
    under. The… Reference for the POST /api/v1/categories endpoint in the
    PharmaFlow API.
sidebar:
  label: Create a category
  badge: POST
title: Create a category
type: openapi-operation
---
Admin and inventory manager. Registers a category medicines can be filed under. The slug derives from the name when none is given, and a clash on slug or name is refused.

`POST /api/v1/categories`

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

- `name` (string, required)
- `slug` (string)

Request body example:

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

**Responses**

- `201` — Category created
- `400` — The body is invalid, or the slug has no letters or digits
- `401` — Not authenticated
- `403` — Caller is not an admin, inventory manager, or branch manager
- `409` — A category with that slug or name already exists

Response example, 201:

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