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

# Read File

> Read the contents of a file in the sandbox

Returns the contents of a file at the specified path in the sandbox.

**Required scope:** `sessions:read`

## Path Parameters

**session\_id** `string` *required*

The session ID (e.g. `ses_abc123`).

## Query Parameters

**path** `string` *required*

Path to the file (e.g. `/src/index.ts`).

## Headers

**Authorization** `string` *required*

Bearer token. Example: `Bearer runtm_xxx`

## Response

**content** `string`

The file contents as a string.

**path** `string`

Full path of the file.

**size** `integer`

File size in bytes.

```bash cURL theme={null}
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/file?path=/src/index.ts" \
  -H "Authorization: Bearer runtm_xxx"
```

```python Python theme={null}
import requests

response = requests.get(
    "https://app.runtm.com/api/cloud/sessions/ses_abc123/file",
    headers={"Authorization": "Bearer runtm_xxx"},
    params={"path": "/src/index.ts"},
)

data = response.json()
print(data["content"])
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({ path: "/src/index.ts" });

const response = await fetch(
  `https://app.runtm.com/api/cloud/sessions/ses_abc123/file?${params}`,
  {
    headers: { "Authorization": "Bearer runtm_xxx" },
  }
);

const { content } = await response.json();
console.log(content);
```

```json 200 theme={null}
{
  "content": "import express from 'express';\n\nconst app = express();\napp.listen(3000);\n",
  "path": "/src/index.ts",
  "size": 67
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.