curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
headers={"Authorization": "Bearer runtm_xxx"},
)
state = response.json()
for port in state["detected_ports"]:
print(f"Port {port['port']} - {port['process']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const state = await response.json();
state.detected_ports.forEach((p) =>
console.log(`Port ${p.port} - ${p.process}`)
);
{
"detected_ports": [
{ "port": 3000, "process": "node" },
{ "port": 5432, "process": "postgres" }
],
"running_processes": [
{ "pid": 1234, "command": "npm run dev" },
{ "pid": 5678, "command": "postgres" }
],
"file_tree": {
"root": "/home/user/project",
"total_files": 142,
"total_dirs": 28
}
}
Lifecycle
Get Workspace State
Retrieve workspace state including detected ports and processes
GET
/
api
/
sessions
/
{session_id}
/
workspace-state
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
headers={"Authorization": "Bearer runtm_xxx"},
)
state = response.json()
for port in state["detected_ports"]:
print(f"Port {port['port']} - {port['process']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const state = await response.json();
state.detected_ports.forEach((p) =>
console.log(`Port ${p.port} - ${p.process}`)
);
{
"detected_ports": [
{ "port": 3000, "process": "node" },
{ "port": 5432, "process": "postgres" }
],
"running_processes": [
{ "pid": 1234, "command": "npm run dev" },
{ "pid": 5678, "command": "postgres" }
],
"file_tree": {
"root": "/home/user/project",
"total_files": 142,
"total_dirs": 28
}
}
Returns the current workspace state of a session, including detected ports, running processes, and file tree information.
Required scope:
sessions:read
Path Parameters
Headers
Response
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
headers={"Authorization": "Bearer runtm_xxx"},
)
state = response.json()
for port in state["detected_ports"]:
print(f"Port {port['port']} - {port['process']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/workspace-state",
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const state = await response.json();
state.detected_ports.forEach((p) =>
console.log(`Port ${p.port} - ${p.process}`)
);
{
"detected_ports": [
{ "port": 3000, "process": "node" },
{ "port": 5432, "process": "postgres" }
],
"running_processes": [
{ "pid": 1234, "command": "npm run dev" },
{ "pid": 5678, "command": "postgres" }
],
"file_tree": {
"root": "/home/user/project",
"total_files": 142,
"total_dirs": 28
}
}