curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/file?path=/src/index.ts" \
-H "Authorization: Bearer runtm_xxx"
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"])
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);
{
"content": "import express from 'express';\n\nconst app = express();\napp.listen(3000);\n",
"path": "/src/index.ts",
"size": 67
}
Files
Read File
Read the contents of a file in the sandbox
GET
/
api
/
sessions
/
{session_id}
/
file
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/file?path=/src/index.ts" \
-H "Authorization: Bearer runtm_xxx"
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"])
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);
{
"content": "import express from 'express';\n\nconst app = express();\napp.listen(3000);\n",
"path": "/src/index.ts",
"size": 67
}
Returns the contents of a file at the specified path in the sandbox.
Required scope:
sessions:read
Path Parameters
string
required
The session ID (e.g.
ses_abc123).Query Parameters
string
required
Path to the file (e.g.
/src/index.ts).Headers
string
required
Bearer token. Example:
Bearer runtm_xxxResponse
string
The file contents as a string.
string
Full path of the file.
integer
File size in bytes.
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/file?path=/src/index.ts" \
-H "Authorization: Bearer runtm_xxx"
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"])
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);
{
"content": "import express from 'express';\n\nconst app = express();\napp.listen(3000);\n",
"path": "/src/index.ts",
"size": 67
}