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

# Make a directory (E2B envd)

envd's `filesystem.Filesystem/MakeDir` (the SDKs' `files.makeDir`), with its missing parents; `already_exists` when the directory is there (the SDKs then return `false`).

` POST /compat/e2b/envd/filesystem.Filesystem/MakeDir `

Make a directory (E2B envd)

envd's `filesystem.Filesystem/MakeDir` (the SDKs' `files.makeDir`), with its missing parents; `already_exists` when the directory is there (the SDKs then return `false`).

## Servers

- ` https://beta-api.b3os.org ` — API (API keys and CLI tokens)

- ` https://beta.b3os.org ` — Dashboard (session cookie and CSRF header; same paths)

## Parameters

### ` X-Access-Token ` (header, required)

The sandbox's envd access token (`b3os_et_…`), from the create or connect answer.

- ` value `: type ` string `

### ` E2b-Sandbox-Id ` (header, required)

The sandbox the call is for (`sandboxID` of the create answer). The token must be this sandbox's.

- ` value `: type ` string `

## Request body (required)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` path `

  - ` path `: type ` string `

  - ` depth `: type ` integer `

    - minimum: ` 0 `

    - maximum: ` 8 `

Example:

```json
{
  "path": "/home/user/data"
}
```

## Responses

### ` 200 ` — The new directory.

Content type: ` application/json `

- ` value `: type ` object `

  - ` entry `: type ` object `

    - ` name `: type ` string `

    - ` type `: type ` string `

      - enum: ` ["FILE_TYPE_FILE","FILE_TYPE_DIRECTORY","FILE_TYPE_SYMLINK"] `

    - ` path `: type ` string `

    - ` size `: type ` string ` — Bytes (an int64 in proto3 JSON).

    - ` mode `: type ` integer `

    - ` permissions `: type ` string `

    - ` modifiedTime `: type ` string `; format ` date-time `

    - ` symlinkTarget `: type ` string `

Response header ` x-request-id ` — The request ID (`req_…`). It is the `instance` of any problem and the key for `GET /v1/requests/{request_id}`.

- ` value `: type ` string `

  - pattern: ` "^req_[0-9a-hjkmnp-tv-z]{26}$" `

Response header ` Server-Timing ` — Phase durations in milliseconds (W3C Server Timing); the handler's phases break the request down. For a
response whose body size is known, `total` runs from reading the request head to writing the response head.
Streaming responses (event streams, WebSockets, chunked bodies) carry no `total` here: they report their
final phases in the terminal event (`job.succeeded`, `job.failed`, `job.canceled`) or the final job. The
time from the first request byte to the last response byte is recorded in the node's metrics and request
log (`GET /v1/requests/{request_id}`). The edge prepends `edge_auth` and `edge_upstream`.


- ` value `: type ` string `

Example:

```json
{
  "entry": {
    "name": "data",
    "type": "FILE_TYPE_DIRECTORY",
    "path": "/home/user/data",
    "size": "4096",
    "mode": 493,
    "permissions": "drwxr-xr-x",
    "modifiedTime": "2026-11-02T13:00:00.000Z"
  }
}
```

### ` 401 ` — The envd call is refused (`envd_token_invalid`), the same answer on every envd path whatever the reason, in E2B's error shape (Connect clients read the 401 as `unauthenticated`).

Content type: ` application/json `

- ` value `: type ` object ` — E2B's error body.

  - Required fields: ` code `, ` message `

  - ` code `: type ` integer ` — The HTTP status.

  - ` message `: type ` string `

Response header ` x-request-id ` — The request ID (`req_…`). It is the `instance` of any problem and the key for `GET /v1/requests/{request_id}`.

- ` value `: type ` string `

  - pattern: ` "^req_[0-9a-hjkmnp-tv-z]{26}$" `

Response header ` Server-Timing ` — Phase durations in milliseconds (W3C Server Timing); the handler's phases break the request down. For a
response whose body size is known, `total` runs from reading the request head to writing the response head.
Streaming responses (event streams, WebSockets, chunked bodies) carry no `total` here: they report their
final phases in the terminal event (`job.succeeded`, `job.failed`, `job.canceled`) or the final job. The
time from the first request byte to the last response byte is recorded in the node's metrics and request
log (`GET /v1/requests/{request_id}`). The edge prepends `edge_auth` and `edge_upstream`.


- ` value `: type ` string `

Example:

```json
{
  "code": 401,
  "message": "envd_token_invalid: the envd access token is missing, expired or not for this sandbox"
}
```

## Request examples

### cURL

```curl
curl -X POST 'https://beta-api.b3os.org/compat/e2b/envd/filesystem.Filesystem/MakeDir' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'X-Access-Token: string' \
  -H 'E2b-Sandbox-Id: string' \
  -H 'Content-Type: application/json' \
  -d '{
  "path": "/home/user/data"
}'
```

### JavaScript

```javascript
const response = await fetch('https://beta-api.b3os.org/compat/e2b/envd/filesystem.Filesystem/MakeDir', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json",
      "X-Access-Token": "string",
      "E2b-Sandbox-Id": "string"
  },
  body: JSON.stringify({
    "path": "/home/user/data"
  })
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'X-Access-Token': 'string',
    'E2b-Sandbox-Id': 'string'
}

response = requests.post('https://beta-api.b3os.org/compat/e2b/envd/filesystem.Filesystem/MakeDir', headers=headers, json={
  "path": "/home/user/data"
})
print(response.json())
```