curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?query=TODO&path=/src" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search",
headers={"Authorization": "Bearer runtm_xxx"},
params={"query": "TODO", "path": "/src"},
)
for result in response.json()["results"]:
print(f"{result['path']}:")
for m in result["matches"]:
print(f" L{m['line']}: {m['content']}")
const params = new URLSearchParams({ query: "TODO", path: "/src" });
const response = await fetch(
`https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?${params}`,
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const { results } = await response.json();
results.forEach((r) => {
console.log(`${r.path}:`);
r.matches.forEach((m) => console.log(` L${m.line}: ${m.content}`));
});
{
"results": [
{
"path": "/src/index.ts",
"matches": [
{ "line": 12, "content": "// TODO: add error handling" },
{ "line": 45, "content": "// TODO: implement caching" }
]
}
]
}
Files
Search Files
Search for files by content in the sandbox
GET
/
api
/
sessions
/
{session_id}
/
files
/
search
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?query=TODO&path=/src" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search",
headers={"Authorization": "Bearer runtm_xxx"},
params={"query": "TODO", "path": "/src"},
)
for result in response.json()["results"]:
print(f"{result['path']}:")
for m in result["matches"]:
print(f" L{m['line']}: {m['content']}")
const params = new URLSearchParams({ query: "TODO", path: "/src" });
const response = await fetch(
`https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?${params}`,
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const { results } = await response.json();
results.forEach((r) => {
console.log(`${r.path}:`);
r.matches.forEach((m) => console.log(` L${m.line}: ${m.content}`));
});
{
"results": [
{
"path": "/src/index.ts",
"matches": [
{ "line": 12, "content": "// TODO: add error handling" },
{ "line": 45, "content": "// TODO: implement caching" }
]
}
]
}
Searches for files matching a query string within the sandbox. Returns matching files with line-level match details.
Required scope:
sessions:read
Path Parameters
string
required
The session ID (e.g.
ses_abc123).Query Parameters
string
required
Search query string.
string
default:"/"
Directory path to scope the search (e.g.
/src).Headers
string
required
Bearer token. Example:
Bearer runtm_xxxResponse
array
Array of matching file results.
string
Path of the matching file.
array
Array of line matches within the file.
integer
Line number of the match.
string
Content of the matching line.
curl "https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?query=TODO&path=/src" \
-H "Authorization: Bearer runtm_xxx"
import requests
response = requests.get(
"https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search",
headers={"Authorization": "Bearer runtm_xxx"},
params={"query": "TODO", "path": "/src"},
)
for result in response.json()["results"]:
print(f"{result['path']}:")
for m in result["matches"]:
print(f" L{m['line']}: {m['content']}")
const params = new URLSearchParams({ query: "TODO", path: "/src" });
const response = await fetch(
`https://app.runtm.com/api/cloud/sessions/ses_abc123/files/search?${params}`,
{
headers: { "Authorization": "Bearer runtm_xxx" },
}
);
const { results } = await response.json();
results.forEach((r) => {
console.log(`${r.path}:`);
r.matches.forEach((m) => console.log(` L${m.line}: ${m.content}`));
});
{
"results": [
{
"path": "/src/index.ts",
"matches": [
{ "line": 12, "content": "// TODO: add error handling" },
{ "line": 45, "content": "// TODO: implement caching" }
]
}
]
}