Query files already on disk in an environment with directory pagination.
Endpoint
GET /agents/environments/{environment_id}/files
Queries live files in the specified environment. A successful call returns 200 and directory pagination. This endpoint verifies that files are on disk and does not return file content.
Request parameters
| Field | Required | Type | Description |
|---|---|---|---|
path | No | string | Directory path, optional, restricts results to an existing absolute directory under /workspace/ |
limit | No | integer | Number of items per page |
page | No | string | Pagination cursor; omit on the first request, then pass the next returned by the previous page |
page and the response cursor field is next; this is not the after cursor used by source files or artifacts.
Request example
Response example
Response fields
| Field | Type | Description |
|---|---|---|
object | string | Page object type, fixed as page |
data | array | Environment files on this page |
next | string / null | Cursor for the next page; null when there is no next page |
has_more | boolean | Whether another page exists |
environment_id | string | Environment ID |
object | string | Environment file object type, fixed as agent.environment.file |
path | string | File path in the environment |
size_bytes | integer | File size in bytes |
data[] contains:
The response contains a data array for the current page and a cursor for the next page. When the directory is empty, data is an empty array.
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Pass an existing absolute directory under /workspace/ |
404 | not_found_error / not_found_error | Use an environment ID that exists and is visible in the current workspace |
{"error":{"type","code","message","param"}}. Gateway errors can use a different structure.