# POST /api/v1/tags

> Create tag

- **Tag:** tags
- **Operation ID:** `create_tag_api_v1_tags_post`

## Description

Create a new tag, optionally in a tag group

## Authentication

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

## Request body

Schema: `TagCreate`

- `name` (string · required) — Name of the tag
- `description` (string) — Description of the tag
- `tag_group_id` (string) — Optional tag group to organize this tag under

## Responses

### 201 — Successful Response

Schema: `TagResponse`

- `name` (string · required) — Name of the tag
- `description` (string) — Description of the tag
- `id` (string · required) — Unique identifier for the tag
- `tag_group_id` (string) — Tag group this tag belongs to
- `tag_group_name` (string) — Name of the tag group (if any)
- `usage_count` (integer) — Number of entities using this tag
- `created_at` (string · date-time · required) — Timestamp when the tag was created
- `updated_at` (string · date-time · required) — Timestamp when the tag was last updated

### 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/tags' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "name": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/tags", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/tags/create-tag
- OpenAPI slice: https://www.ondayzero.com/docs/reference/tags/create-tag/openapi.json
- Other endpoints in **tags**: https://www.ondayzero.com/docs/reference/tags
