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

# Make Directory

> Create a directory (and all parent directories) inside a sandbox.

Creates a directory at the specified path, including all necessary parent
directories. Equivalent to `mkdir -p`. If the directory already exists, the
operation succeeds silently.

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.
</ParamField>

## Request Body

<ParamField body="path" type="string" required>
  Absolute path of the directory to create inside the sandbox. All intermediate
  directories are created automatically.

  Example: `"/home/user/data/output/results"`
</ParamField>

<ParamField body="username" type="string">
  Unix user to own the created directory. Defaults to the envd default user.
</ParamField>

## Response

Returns the envd mkdir confirmation as a JSON object.

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files/mkdir \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "path": "/home/user/data/output" }'
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  sbx.files.make_dir("/home/user/data/output")
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  await sbx.files.makeDir("/home/user/data/output");
  ```
</CodeGroup>

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `400`  | Invalid request body       |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
| `502`  | envd daemon unreachable    |
| `503`  | Sandbox has no VM          |
