# Read a mount file

Read one file of a mount, with its content.

`GET https://api.smallworld.sh/api/v1/mounts/:mountId/files/content`

## 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 GET 'https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/files/content?path=/faq.md' \
  -H "Authorization: Bearer $SMALLWORLD_API_KEY"
```

### typescript

```typescript
const response = await fetch("https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/files/content?path=/faq.md", {
  method: "GET",
  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.get(
    "https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/files/content?path=/faq.md",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## Responses

Returns the entry as GET /mounts/:mountId/files lists it, with type file, plus content and encoding. Content that is valid UTF-8 without null bytes is returned as text with encoding utf8; anything else as base64.

### 200

Returns the entry as GET /mounts/:mountId/files lists it, with type file, plus content and encoding. Content that is valid UTF-8 without null bytes is returned as text with encoding utf8; anything else as base64.

```json
{
  "path": "/faq.md",
  "type": "file",
  "size": 37,
  "hash": "e08222b5163270229c47f385e4d0e8a9de482f71d0364a66de787c09b3b63b0a",
  "modifiedAt": "2026-10-10T12:00:01.000Z",
  "content": "# FAQ\n\nRefunds take 3 business days.\n",
  "encoding": "utf8"
}
```

### 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_file_not_found: The mount has no file at this path. The message names the path as the terminal sees it.

#### 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"
}
```

#### mount_file_not_found

The mount has no file at this path. The message names the path as the terminal sees it.

```json
{
  "statusCode": 404,
  "code": "mount_file_not_found",
  "message": "No file or folder at /workspace/docs/faq.md"
}
```

### 500

internal_error: An unexpected server error.

#### internal_error

An unexpected server error.

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

## Notes

- The encoding depends on the stored bytes, not on how they were written. Decode content with its encoding.

- Folders have no content: a folder's path returns 404.
