# Create a mount

Create a folder that is mounted into the terminal of every user in the workspace, of one group's members, or of one user.

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

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| path | body | string | Yes | Where the mount appears, inside /workspace, such as /workspace/docs. A canonical absolute path without empty, . or .. segments or a trailing slash, at most 1024 bytes with each segment at most 255 bytes. |
| scope | body | string | Yes | global for every user in the workspace, group for the members of one group, or user for one user. |
| groupId | body | string | No | Your application's group ID. Required for a group mount, and only allowed for one. The group must already exist. |
| userId | body | string | No | Your application's user ID. Required for a user mount, and only allowed for one. The user must already exist. |
| description | body | string \| null | No | Optional text for agents about what the mount holds, at most 2000 characters. Surrounding whitespace is removed, and an empty description is stored as null. |
| settings | body | object | No | How agents' changes to the mount are handled: create, update, delete, move, and rename, each allow, ask, or deny. Reads are always allowed. Settings you leave out are ask. |

## Request examples

### curl

```curl
curl --fail-with-body -X POST 'https://api.smallworld.sh/api/v1/mounts' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "path": "/workspace/docs",
  "scope": "group",
  "groupId": "team_42",
  "description": "Product documentation. Answers to customer questions go in faq.md.",
  "settings": {
    "create": "allow"
  }
}'
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/mounts", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({
  "path": "/workspace/docs",
  "scope": "group",
  "groupId": "team_42",
  "description": "Product documentation. Answers to customer questions go in faq.md.",
  "settings": {
    "create": "allow"
  }
}),
});
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",
    headers={"Authorization": f"Bearer {api_key}"},
    json={
  "path": "/workspace/docs",
  "scope": "group",
  "groupId": "team_42",
  "description": "Product documentation. Answers to customer questions go in faq.md.",
  "settings": {
    "create": "allow"
  }
},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns id, path, scope (global, group, or user), groupId (your group ID, for a group mount), userId (your user ID, for a user mount), nullable description, settings with create, update, delete, move, and rename (each allow, ask, or deny), fileCount (files, not folders), totalBytes, and ISO 8601 createdAt and updatedAt timestamps. groupId and userId are null when they don't apply.

### 201

Returns id, path, scope (global, group, or user), groupId (your group ID, for a group mount), userId (your user ID, for a user mount), nullable description, settings with create, update, delete, move, and rename (each allow, ask, or deny), fileCount (files, not folders), totalBytes, and ISO 8601 createdAt and updatedAt timestamps. groupId and userId are null when they don't apply.

```json
{
  "id": "0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d",
  "path": "/workspace/docs",
  "scope": "group",
  "groupId": "team_42",
  "userId": null,
  "description": "Product documentation. Answers to customer questions go in faq.md.",
  "settings": {
    "create": "allow",
    "update": "ask",
    "delete": "ask",
    "move": "ask",
    "rename": "ask"
  },
  "fileCount": 0,
  "totalBytes": 0,
  "createdAt": "2026-10-10T12:00:00.000Z",
  "updatedAt": "2026-10-10T12:00:00.000Z"
}
```

### 400

mount_invalid_path: path isn't inside /workspace (such as /docs, or /workspace itself), isn't canonical (such as /workspace/a/../b or a trailing slash), contains null bytes, backslashes, or control characters, or is longer than 1024 bytes or has a segment over 255 bytes. The message names the problem. invalid_request: The body is invalid: scope isn't global, group, or user, groupId or userId is missing or doesn't match the scope, a setting isn't allow, ask, or deny, the description is too long, or the body has an unknown field. The message names the problem.

#### mount_invalid_path

path isn't inside /workspace (such as /docs, or /workspace itself), isn't canonical (such as /workspace/a/../b or a trailing slash), contains null bytes, backslashes, or control characters, or is longer than 1024 bytes or has a segment over 255 bytes. The message names the problem.

```json
{
  "statusCode": 400,
  "code": "mount_invalid_path",
  "message": "path must be a path inside /workspace, such as /workspace/docs"
}
```

#### invalid_request

The body is invalid: scope isn't global, group, or user, groupId or userId is missing or doesn't match the scope, a setting isn't allow, ask, or deny, the description is too long, or the body has an unknown field. The message names the problem.

```json
{
  "statusCode": 400,
  "code": "invalid_request",
  "message": "groupId is required for a group mount, and only for one"
}
```

### 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

group_not_found: scope is group and the group does not exist in your workspace. Create it with POST /groups first; nothing is changed. user_not_found: scope is user and the user does not exist in your workspace. Create it with POST /users first; nothing is changed.

#### group_not_found

scope is group and the group does not exist in your workspace. Create it with POST /groups first; nothing is changed.

```json
{
  "statusCode": 404,
  "code": "group_not_found",
  "message": "Group not found"
}
```

#### user_not_found

scope is user and the user does not exist in your workspace. Create it with POST /users first; nothing is changed.

```json
{
  "statusCode": 404,
  "code": "user_not_found",
  "message": "User not found"
}
```

### 409

mount_path_conflict: Another mount with the same scope and target (the workspace, the same group, or the same user) has the same path or one that contains or lies inside this one. Mounts of different scopes may overlap.

#### mount_path_conflict

Another mount with the same scope and target (the workspace, the same group, or the same user) has the same path or one that contains or lies inside this one. Mounts of different scopes may overlap.

```json
{
  "statusCode": 409,
  "code": "mount_path_conflict",
  "message": "/workspace/docs/team overlaps /workspace/docs, another mount of the same group"
}
```

### 413

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

#### 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

- A mount is a folder Smallworld stores. Every command of a user who gets the mount sees it at its path, in every World. A new mount is empty: add files with PUT /mounts/:mountId/files/content.

- Reads are always allowed. The settings govern agents' changes: allow saves them at the end of the command, ask holds the mount's changes for one approval at the end of the command, and deny makes the operation fail at once with Permission denied. A move to another folder is move; a new name in the same folder is rename.

- A group mount belongs to exactly one group, and a user mount to exactly one user. Two groups that each need /workspace/docs get two mounts with separate files.

- Two mounts with the same scope and target (two global mounts, two mounts of one group, or two mounts of one user) can't have the same path, or paths where one lies inside the other, such as /workspace/docs and /workspace/docs/team. Mounts of different scopes may overlap: for each user the broader one wins (global, then group, then user), and the other isn't mounted for that user while the overlap lasts. GET /users/:userId/mounts shows which one wins.

- Deleting a group or a user also deletes their mounts with the files. Creating, editing, and deleting mounts is recorded in the workspace's audit log.
