---
title: "Create a folder"
method: POST
path: "/api/v1/folders"
tags: ["Folders"]
---

# Create a folder

`POST /api/v1/folders`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/folders`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Creates a folder under the root, a parentId, or a parentPath (mutually exclusive; the parent must already exist). Sibling folder names are unique case-insensitively — a duplicate name responds 409.

## Request body

- object
  - `name` string, required
  - `parentId` string, nullable
  - `parentPath` string, nullable: Parent folder path; "/" or omitted creates under the root.

## Response `201`

The created folder.

- object
  - `id` string, required
  - `name` string, required
  - `parentId` string, nullable, required: The parent folder's id, or null for a top-level folder.
  - `path` string, required: The folder's full path. Paths change on rename; store ids.

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `403`: The caller is not permitted to perform this action.
- `404`: The resource was not found.
- `409`: Response.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
