# POST /api/v1/businesses/{business_id}/managerial-key-mappings/key-types

> Create a managerial key type

- **Tag:** managerial-key-mappings
- **Operation ID:** `create_managerial_key_type_api_v1_businesses__business_id__managerial_key_mappings_key_types_post`

## Description

Add a new key type (a column of the mapping table). The key is a lowercase slug and must be unique within the business.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `ManagerialKeyTypeCreateRequest`

- `key` (string · required) — Stable slug used in the API (lowercase, digits, underscores).
- `label` (string · required)
- `description` (string)
- `sort_order` (integer)

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_ManagerialKeyTypeResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (ManagerialKeyTypeResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 409 — Conflict - Resource already exists

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/businesses/{business_id}/managerial-key-mappings/key-types' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": "string",
  "label": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses/{business_id}/managerial-key-mappings/key-types', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "key": "string",
  "label": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "key": "string",
  "label": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/businesses/{business_id}/managerial-key-mappings/key-types", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/managerial-key-mappings/create-managerial-key-type
- OpenAPI slice: https://www.ondayzero.com/docs/reference/managerial-key-mappings/create-managerial-key-type/openapi.json
- Other endpoints in **managerial-key-mappings**: https://www.ondayzero.com/docs/reference/managerial-key-mappings
