# Create a document category.

`POST /api/plugins/docs/categories`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [CreateDocumentCategoryDTO](https://sourcey-gauzy.pages.dev/api-reference/models/createdocumentcategorydto/index.md)

- `tenant` (optional)
  Type: object

- `tenantId` (optional)
  Type: string

- `organization` (required)
  Type: object

- `organizationId` (required)
  Type: string

- `sentTo` (optional)
  Type: string

- `name` (required)
  Type: string

- `slug` (optional)
  Type: string

- `color` (optional)
  Type: string

- `icon` (optional)
  Type: string

- `description` (optional)
  Type: string

Responses:

- 201: Category created successfully.

Content type: application/json

Type: object

Schema: [DocumentCategory](https://sourcey-gauzy.pages.dev/api-reference/models/documentcategory/index.md)

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `name` (required)
  Type: string

- `slug` (required)
  Type: string

- `color` (optional)
  Type: string

- `icon` (optional)
  Type: string

- `description` (optional)
  Type: string

- `isSystem` (required)
  Type: boolean

- 409: A category with this name already exists.

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/docs/categories' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "name": "string",
  "slug": "string",
  "color": "string",
  "icon": "string",
  "description": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "name": "string",
  "slug": "string",
  "color": "string",
  "icon": "string",
  "description": "string"
}`;

const response = await fetch('http://localhost:3000/api/plugins/docs/categories', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "name": "string",
  "slug": "string",
  "color": "string",
  "icon": "string",
  "description": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/plugins/docs/categories',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
