# Create a mount folder

Create a folder in a mount, with any missing parent folders. Send no body.

`POST https://api.smallworld.sh/api/v1/mounts/:mountId/folders`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| mountId | path | UUID | Yes | The mount's ID, returned as id when the mount was created. |
| path | query | string | Yes | A path inside the mount, such as /guides/refunds.md for /workspace/docs/guides/refunds.md in a mount at /workspace/docs. guides/refunds.md names the same file. No empty, . or .. segments and no trailing slash. URL-encode it. |

## Request examples

### curl

```curl
curl --fail-with-body -X POST 'https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/folders?path=/guides' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY"
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/folders?path=/guides", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
```

### python

```python
response = requests.post(
    "https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/folders?path=/guides",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns status (created or unchanged) and entry, the folder as GET /mounts/:mountId/files lists it.

### 201 · Created

The folder was created, with any missing parent folders.

```json
{
  "status": "created",
  "entry": {
    "path": "/guides",
    "type": "directory",
    "size": 0,
    "hash": "",
    "modifiedAt": "2026-10-10T12:00:00.000Z"
  }
}
```

### 200 · Unchanged

A folder already exists at this path. Nothing changed.

```json
{
  "status": "unchanged",
  "entry": {
    "path": "/guides",
    "type": "directory",
    "size": 0,
    "hash": "",
    "modifiedAt": "2026-10-10T12:00:00.000Z"
  }
}
```

### 400

invalid_request: The path query parameter is missing or empty, or the request has another query parameter; the message names the problem. mount_invalid_path: The path query parameter isn't a canonical path inside the mount: it is / itself, ends with a slash, has empty, . or .. segments, contains null bytes, backslashes, or control characters, or is too long.

#### invalid_request

The path query parameter is missing or empty, or the request has another query parameter; the message names the problem.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "Unknown query parameter: color"
}
```

#### mount_invalid_path

The path query parameter isn't a canonical path inside the mount: it is / itself, ends with a slash, has empty, . or .. segments, contains null bytes, backslashes, or control characters, or is too long.

```json
{
  "statusCode": 400,
  "code": "mount_invalid_path",
  "message": "path must be a canonical path, without empty, . or .. segments or a trailing slash"
}
```

### 401

authentication_required: The Authorization header is missing or empty. invalid_api_key: The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

#### authentication_required

The Authorization header is missing or empty.

```json
{
  "statusCode": 401,
  "code": "authentication_required",
  "message": "Authentication is required"
}
```

#### invalid_api_key

The API key is invalid or revoked, or the header doesn't use the Bearer scheme.

```json
{
  "statusCode": 401,
  "code": "invalid_api_key",
  "message": "The API key is invalid or revoked"
}
```

### 403

ip_not_allowed: The request came from an address outside the workspace's IP allowlist.

#### ip_not_allowed

The request came from an address outside the workspace's IP allowlist.

```json
{
  "statusCode": 403,
  "code": "ip_not_allowed",
  "message": "The source IP address is not allowed by this account's security settings"
}
```

### 404

mount_not_found: The mount does not exist in your workspace, or mountId isn't a mount ID.

#### mount_not_found

The mount does not exist in your workspace, or mountId isn't a mount ID.

```json
{
  "statusCode": 404,
  "code": "mount_not_found",
  "message": "Mount not found"
}
```

### 409

mount_file_conflict: A file exists at this path or at one of its parents. The message names the paths as the terminal sees them.

#### mount_file_conflict

A file exists at this path or at one of its parents. The message names the paths as the terminal sees them.

```json
{
  "statusCode": 409,
  "code": "mount_file_conflict",
  "message": "/workspace/docs/guides is a file"
}
```

### 413

mount_limit: The mount would hold more than 10,000 files and folders. Nothing is created. request_too_large: The JSON body is larger than 12 MiB. File uploads count toward it, base64 or escaping included.

#### mount_limit

The mount would hold more than 10,000 files and folders. Nothing is created.

```json
{
  "statusCode": 413,
  "code": "mount_limit",
  "message": "The mount would exceed 10,000 files and folders"
}
```

#### request_too_large

The JSON body is larger than 12 MiB. File uploads count toward it, base64 or escaping included.

```json
{
  "statusCode": 413,
  "code": "request_too_large",
  "message": "The request body is larger than 12 MiB."
}
```

### 415

unsupported_media_type: The request has a body that isn't JSON. Send JSON with Content-Type: application/json, or no body at all.

#### unsupported_media_type

The request has a body that isn't JSON. Send JSON with Content-Type: application/json, or no body at all.

```json
{
  "statusCode": 415,
  "code": "unsupported_media_type",
  "message": "Send the request body as JSON with Content-Type: application/json."
}
```

### 500

internal_error: An unexpected server error.

#### internal_error

An unexpected server error.

```json
{
  "statusCode": 500,
  "code": "internal_error",
  "message": "Internal server error"
}
```

## Notes

- Returns 201 when the folder was created, or 200 with status unchanged when it already existed, so a retry is safe.

- This write is direct: it skips the mount's settings, tool call hooks, and approvals, and takes effect at once. It appears in the mount's change log in the dashboard. It always overwrites, without a version check.

- Mounts keep empty folders. A mount holds at most 10,000 files and folders.
