---
search:
  tags:
    - Categories
    - POST
seo:
  description: >-
    Create a category. Requires a Write key. Reference for the POST /categories
    endpoint in the scango.ch API.
sidebar:
  label: Create category
  badge: POST
title: Create category
type: openapi-operation
---
Create a category. Requires a Write key.

`POST /categories`

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

- `name` (string, required)
- `externalId` (string) — Optional external identifier
- `index` (number)
- `showOnScreen` (boolean)
- `imageUrl` (string)
- `marginMinPercent` (number)
- `marginMaxPercent` (number)
- `hideStore` (string[]) — An empty array is not stored.
- `allowStore` (string[]) — An empty array is not stored.

Request body example:

```json
{
  "name": "Beverages",
  "index": 1,
  "showOnScreen": true
}
```

**Responses**

- `200` — Category created
- `400` — Invalid parameters or body.
- `403` — Missing, unknown or inactive API key, or a Read key on a write operation.

Response example, 200:

```json
{
  "success": true,
  "id": "newCategoryId"
}
```

Response example, 400:

```json
{
  "statusCode": 400,
  "message": "Validation failed for Field: name, Error: Required",
  "timestamp": "2024-04-20T12:00:00.000Z",
  "path": "/api/v1/suppliers"
}
```

Response example, 403:

```json
{
  "statusCode": 403,
  "message": "Unknown Error",
  "timestamp": "2024-04-20T12:00:00.000Z",
  "path": "/api/v1/products"
}
```
