Skip to main content
List files and directories in the sandbox filesystem.
curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/list \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/home/user"
  }'

Request Parameters

ParameterTypeRequiredDescription
pathstringYesDirectory path to list

Response

{
  "files": [
    {
      "name": "data.txt",
      "type": "file",
      "size": 1024,
      "modified": "2025-01-27T10:30:00Z"
    },
    {
      "name": "output",
      "type": "directory",
      "size": 0,
      "modified": "2025-01-27T10:25:00Z"
    }
  ],
  "path": "/home/user"
}

Response Fields

FieldTypeDescription
filesarrayList of files and directories
files[].namestringFile or directory name
files[].typestring”file” or “directory”
files[].sizeintegerSize in bytes (0 for directories)
files[].modifiedstringLast modified timestamp (ISO 8601)
pathstringListed directory path

Example: List Root Directory

curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/list \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/"
  }'

Next Steps