> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drime.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Folder

> Create a new folder

## Overview

Creates a new folder in the specified location.

## Query Parameters

<ParamField query="workspaceId" type="integer">
  Workspace ID. Use `0` for personal workspace.
</ParamField>

## Request Body

<ParamField body="name" type="string" required>
  Name for the new folder
</ParamField>

<ParamField body="parentId" type="integer">
  Parent folder ID. Use `null` to create in root.
</ParamField>

## Response

<ResponseField name="folder" type="object">
  The newly created folder object
</ResponseField>

<ResponseField name="status" type="string">
  Request status (`success`)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://app.drime.cloud/api/v1/folders?workspaceId=0" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My New Folder",
      "parentId": null
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://app.drime.cloud/api/v1/folders?workspaceId=0',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'My New Folder',
        parentId: null // null = root, or specify folder ID
      })
    }
  );

  const { folder } = await response.json();
  console.log(`Created folder: ${folder.name} (ID: ${folder.id})`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://app.drime.cloud/api/v1/folders',
      params={'workspaceId': 0},
      headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
      json={
          'name': 'My New Folder',
          'parentId': None  # None = root
      }
  )

  folder = response.json()['folder']
  print(f"Created folder: {folder['name']} (ID: {folder['id']})")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "status": "success",
    "folder": {
      "id": 485529680,
      "name": "My New Folder",
      "type": "folder",
      "hash": "NDg1NTI5NjgwfA",
      "file_size": 0,
      "parent_id": null,
      "workspace_id": 0,
      "path": "485529680",
      "created_at": "2024-01-20T10:00:00.000000Z",
      "updated_at": "2024-01-20T10:00:00.000000Z"
    }
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "status": "error",
    "message": "The given data was invalid.",
    "errors": {
      "name": "The name field is required."
    }
  }
  ```
</ResponseExample>
