Skip to content
Hayonix

API reference · Sandboxes

List a directory of the sandbox’s workspace

GET/v1/sandboxes/{sandbox_id}/files
API keysandbox:readProject
TypeScript
client.sandboxes.listFiles()
Python
client.sandboxes.list_files()
CLI
hayonix sandboxes files list

Lists one directory (not recursive), sorted by name, at most 1000 entries. Works only while the sandbox is running (409 sandbox_not_ready while it starts, sandbox_ended after it ends); like every file operation it counts as activity for the idle timeout.

Project API key (Authorization: Bearer sk_…), or a console session. Requires the sandbox:read permission (a key's scope, or a role that includes it).

Examples

The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.

curl -sS "$API_BASE_URL/sandboxes/sbx_01jc5zq4m8k3v6x9t2w7r0b1e4/files" \
  -H "Authorization: Bearer $API_KEY"

Request

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Path parameters

  • sandbox_idstringrequired

    ID of the sandbox

    ID with prefix sbx_

Query parameters

  • pathstring

    Relative to the workspace (/workspace); "" or "." is the workspace itself

    up to 1024 characters

Response

200 SandboxFileList — The directory’s entries, by name

  • objectstringrequired

    Always `list`: the type of this object

    One oflist

  • pathstringrequired

    The directory listed, relative to the workspace

  • The items

    Show 6 fields of data
    • objectstringrequired

      Always `sandbox_file`: the type of this object

      One ofsandbox_file

    • namestringrequired

      Its name

    • pathstringrequired

      Relative to the workspace

    • typestringrequired

      `file`, `directory`, `symlink` (a symbolic link) or `other` (for example a socket)

      One offiledirectorysymlinkother

    • sizeintegerrequired

      Size in bytes

    • modified_atstring (date-time)required

      Time modified (ISO 8601, UTC)

  • next_cursorany JSON | nullrequired

    Always null: a listing is one page, cut short when `truncated` is true

  • truncatedbooleanrequired

    More than 1000 entries: the rest are left out

Example response
Example response
{
  "object": "list",
  "path": "string",
  "data": [
    {
      "object": "sandbox_file",
      "name": "string",
      "path": "string",
      "type": "file",
      "size": 1,
      "modified_at": "2026-01-01T00:00:00.000Z"
    }
  ],
  "next_cursor": {},
  "truncated": true
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.