Skip to main content
POST
List files
Lists a directory on the machine hosting a cloud browser, newest first. Use it to see what the agent downloaded, then read a file out or write one in for the agent to use. Returns the directory path, its files, and truncated, true when the listing stopped at max_entries.
The session_id here is the browser session id, not the agent session id from /api/v2/sessions. Each cloud browser runs in its own browser session, and the agent publishes that id on the events stream as a RunnerSessionEvent (data.runner_session_id) when it connects. An agent session id is answered with 404.
Only the browser’s download directory (~/Downloads) is reachable. Paths outside it, including the browser profile, are rejected.

Path parameters

string
required
The browser session id, from the session’s RunnerSessionEvent.

Request body

string
default:"~/Downloads"
Directory to list.
integer
default:"500"
Maximum number of entries to return. When the directory holds more, truncated is true and the page ends at the oldest entry returned.
string
Page cursor: the modified_at of the last entry of the previous page. Always send it together with name_after.
string
Page cursor: the name of the last entry of the previous page. Modification times are not unique, so the name is what keeps files sharing one from being skipped.

Response

string
The listed directory, resolved.
array
Entries, newest first. Each is { name, path, size_bytes, modified_at, is_dir }.
boolean
true when the listing stopped at max_entries. Take modified_at and name from the last entry and send them as modified_before and name_after for the next page.

Examples

Response

Page through a large directory

Pass the last entry’s modified_at and name back as the cursor until truncated is false:
Python