> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorlake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Directory

> List directory contents through the sandbox proxy.

List the contents of a sandbox directory.

## Endpoint

```http theme={null}
GET /api/v1/files/list?path=<absolute-or-relative-path>
```

## Example Request

```bash theme={null}
curl "https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/files/list?path=/workspace" \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY"
```

## Response

Tensorlake returns `200 OK`:

```json theme={null}
{
  "path": "/workspace",
  "entries": [
    {
      "name": "src",
      "is_dir": true,
      "size": null,
      "modified_at": 1710000000000
    },
    {
      "name": "data.csv",
      "is_dir": false,
      "size": 24,
      "modified_at": 1710000001000
    }
  ]
}
```

Entries are sorted with directories first and then alphabetically. If the path is not a directory, Tensorlake returns `400 Bad Request`. Missing paths return `404 Not Found`.


## OpenAPI

````yaml get /api/v1/files/list
openapi: 3.1.0
info:
  title: Tensorlake API
  description: >-
    Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
    Workflows
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.tensorlake.ai/
security:
  - bearerAuth: []
tags:
  - name: Tensorlake Cloud API
    description: >-
      Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
      Workflows
paths:
  /api/v1/files/list:
    servers:
      - url: https://{identifier}.sandbox.tensorlake.ai
        description: >-
          Example sandbox proxy host for a specific running sandbox. For
          programmatic access, use the sandbox's `ingress_endpoint`.
        variables:
          identifier:
            default: example-sandbox
            description: The sandbox ID or sandbox name.
    parameters:
      - name: path
        in: query
        description: Absolute or relative directory path inside the sandbox.
        required: true
        schema:
          type: string
    get:
      tags:
        - sandbox-files
      summary: List a directory
      description: List directory contents through the sandbox proxy.
      operationId: sandbox_file_list
      responses:
        '200':
          description: Directory listing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxDirectoryListResponse'
        '400':
          description: Path is not a directory
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
        '403':
          description: Path traversal rejected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
        '404':
          description: Directory not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
components:
  schemas:
    SandboxDirectoryListResponse:
      type: object
      required:
        - path
        - entries
      properties:
        path:
          type: string
        entries:
          type: array
          items:
            $ref: '#/components/schemas/SandboxDirectoryEntry'
    SandboxProxyError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
    SandboxDirectoryEntry:
      type: object
      required:
        - name
        - is_dir
      properties:
        name:
          type: string
        is_dir:
          type: boolean
        size:
          type:
            - integer
            - 'null'
          format: int64
        modified_at:
          type:
            - integer
            - 'null'
          format: int64
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````