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

# Create Directory in Sandbox

> Create a directory in the sandbox using the HopX VM Agent API. Create new directories or directory structures for organizing files and managing filesystem hierarchy. Learn how to use POST /files/mkdir endpoint to create directories with parent directory creation. Includes request examples and directory management.

Create a directory in the sandbox. Parent directories are created automatically if needed.

## Endpoint

```
POST /files/mkdir
```

## Request

### Headers

```
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
```

### Body Parameters

| Parameter | Type   | Required | Description              |
| --------- | ------ | -------- | ------------------------ |
| `path`    | string | Yes      | Directory path to create |

### Example Request

```bash theme={null}
curl -X POST https://sandbox_abc123xyz.hopx.dev/files/mkdir \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/workspace/project/src"
  }'
```

## Response

### Success (200 OK)

```json theme={null}
{
  "path": "/workspace/project/src",
  "message": "Directory created successfully"
}
```

## Status Codes

| Code | Description       |
| ---- | ----------------- |
| 200  | Directory created |
| 401  | Unauthorized      |
| 403  | Path not allowed  |

## Use Cases

### Setup Project Structure

```bash theme={null}
for DIR in "src" "tests" "docs" "data"; do
  curl -X POST https://sandbox_abc123xyz.hopx.dev/files/mkdir \
    -H "Authorization: Bearer YOUR_JWT_TOKEN" \
    -H "Content-Type: application/json" \
    -d "{\"path\": \"/workspace/project/$DIR\"}"
done
```

## Related

* **SDK**: [sandbox.files.mkdir()](/sdk/python/files#mkdir) - Python SDK method
* [CLI Reference](/cli/introduction) - Command-line interface

## Next Steps

* **[Write File](/api/vm-agent/write-file)** - Create files in directory
* **[List Files](/api/vm-agent/list-files)** - Verify directory created
