# Create a folder

**Publié le** : 2026-05-08
**Catégorie** : Media & Files

## `POST /media-folders`

**Create a folder**

Creates a new media folder. Set `parentId` to create a subfolder.

Required permissions: `media.upload`

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | Required. Display name. 1-255 characters |
| `parentId` | string | No | Parent resource ID |


### Responses

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


> **Notes:** - Maximum nesting depth: 3 levels.
> 
> - Folder names must be unique within the same parent.

### Examples

```bash
curl -X POST https://api.lynkow.com/v1/media-folders \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Product Photos", "parentId": null}'
```

### Response Example

```json
{
  "data": {
    "id": "f4d5e6f7-a8b9-0123-defa-345678901234",
    "name": "Product Photos",
    "parentId": null,
    "mediaCount": 0,
    "createdAt": "2025-04-06T11:00:00.000Z"
  }
}
```

---