---
search:
  tags:
    - Categorie
    - POST
seo:
  description: Crea una categoria. Richiede una chiave Write.
sidebar:
  label: Crea categoria
  badge: POST
title: Crea categoria
type: openapi-operation
---
Crea una categoria. Richiede una chiave Write.

`POST /categories`

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

- `name` (string, required)
- `externalId` (string) — Identificativo esterno facoltativo
- `index` (number)
- `showOnScreen` (boolean)
- `imageUrl` (string)
- `marginMinPercent` (number)
- `marginMaxPercent` (number)
- `hideStore` (string[]) — Un array vuoto non viene salvato.
- `allowStore` (string[]) — Un array vuoto non viene salvato.

Request body example:

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

**Responses**

- `200` — Categoria creata
- `400` — Parametri o body non validi.
- `403` — Chiave API mancante, sconosciuta o inattiva, oppure chiave Read su un’operazione di scrittura.

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"
}
```
