# Create a category

**Publié le** : 2026-05-08
**Catégorie** : Core CMS

## `POST /categories`

**Create a category**

Creates a new category. Set `parentId` to create it as a child of an
existing category. The slug is auto-generated from the name if not provided.

Required permissions: `categories.create`

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | Required. Display name. 1-255 characters |
| `slug` | string | Yes | Required. URL-friendly identifier, unique per site and locale. 1-255 characters |
| `description` | string \| null | No | Description text |
| `image` | string \| null | No | Image URL |
| `parentId` | string \| null | No | Parent resource ID |
| `locale` | string | No | BCP 47 locale code (e.g. "en", "fr") |
| `sitemapPriority` | number \| null | No | Sitemap priority (0.0-1.0) |
| `sitemapChangefreq` | "always" \| "hourly" \| "daily" \| "weekly" \| "monthly" \| "yearly" \| "never" \| null | No | Sitemap change frequency (daily, weekly, monthly) |
| `contentMode` | "standard" \| "structured" | No | One of: standard, structured |
| `schema` | object | No | Field schema definition |
| `schemaSource` | "own" \| "inherit" | No | One of: own, inherit |
| `displayOrder` | number | No | Number |
| `jsonLdGraph` | object[] | No | Max 50 characters. Array of objects |
| `jsonLdExclusions` | string[] | No | Max 50 characters. Array of strings |


### Responses

| Status | Description |
| --- | --- |
| `201` | Successful response |
| `401` | Unauthorized — invalid or missing API token |
| `403` | Forbidden — insufficient permissions |
| `422` | Validation error |


> **Notes:** - Maximum nesting depth is not enforced, but 3 levels is recommended for UX.

### Examples

```bash
curl -X POST https://api.lynkow.com/v1/categories \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "API Guides",
    "description": "REST API integration tutorials",
    "parentId": 1
  }'
```

### Response Example

```json
{
  "data": {
    "id": 5,
    "name": "API Guides",
    "slug": "api-guides",
    "description": "REST API integration tutorials",
    "parentId": 1,
    "locale": "en",
    "contentCount": 0,
    "createdAt": "2025-04-06T12:00:00.000Z",
    "updatedAt": "2025-04-06T12:00:00.000Z"
  }
}
```

---