---
title: "Create a folder"
method: POST
path: "/v1/workspaces/{workspace_id}/folders"
tags: ["Folders"]
---

# Create a folder

`POST /v1/workspaces/{workspace_id}/folders`

## Request

- Base URL: `https://api.stacksync.com`
- URL: `https://api.stacksync.com/v1/workspaces/{workspace_id}/folders`
- Auth: HTTP bearer

At the root, or inside another folder of the same region (parent_folder_id). A folder_resource_id or name already used in the region of the workspace is refused with 409. With validate_only, every check runs and 204 answers, nothing is created.

## Path parameters

- `workspace_id` integer, required

## Query parameters

- `region` 'besg' | 'usnv', required

## Headers

- `Idempotency-Key` string, nullable: Makes the create retry-safe for 24 hours: a retry with the same key answers the resource the first call created, with the Idempotent-Replayed: true header, and creates nothing. 1 to 255 visible ASCII characters. The same key with a different request answers 422; while the first call still runs, 409.

## Request body

- CreateFolderBody
  - `folder_name` string, required
  - `folder_resource_id` string, nullable: A unique, readable id of the folder in the region of the workspace (lowercase letters, digits and _); derived from the name when absent
  - `parent_folder_id` string, uuid, nullable: The folder to create it in; the root when absent
  - `validate_only` boolean: Run every check of the write and answer 204 without writing: a refused write answers the error the write would

## Response `201`

Created

- CreatedFolder
  - `folder_id` string, required
  - `folder_name` string, required
  - `folder_resource_id` string, required
  - `parent_folder_id` string, nullable, required: The folder it is in; None at the root
  - `region` 'besg' | 'usnv', required

## Other responses

- `204`: No Content
- `400`: Bad Request
- `403`: Forbidden
- `409`: Conflict
- `422`: Unprocessable Content

---

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