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

# List Files

> List files in a drive with optional folder navigation and pagination.

## Query Parameters

<ParamField query="drive_id" type="string" required>
  The ID of the drive to list files from.
</ParamField>

<ParamField query="prefix" type="string">
  Filter files by path prefix. Use this for folder-based navigation (e.g., `documents/`).
</ParamField>

<ParamField query="delimiter" type="string">
  A delimiter for grouping files into folders. Typically `/`.
</ParamField>

<ParamField query="page" type="integer">
  The page number for pagination. Defaults to 1.
</ParamField>

<ParamField query="limit" type="integer">
  The number of files per page. Defaults to 50.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.getagentdrive.com/v0/files?drive_id=drv_abc123&prefix=documents/&delimiter=/&limit=20" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "file_xyz789",
        "drive_id": "drv_abc123",
        "path": "documents/report.pdf",
        "filename": "report.pdf",
        "mime_type": "application/pdf",
        "size": 24576,
        "content_hash": "sha256:abcdef1234567890",
        "content_preview": null,
        "tags": ["report"],
        "metadata": {},
        "created_at": "2026-01-15T10:30:00Z",
        "updated_at": "2026-01-15T10:30:00Z"
      }
    ],
    "folders": ["documents/images/", "documents/drafts/"],
    "total": 1,
    "page": 1,
    "limit": 20
  }
  ```
</ResponseExample>

## Response

<ResponseField name="data" type="object[]">
  An array of file records matching the query.
</ResponseField>

<ResponseField name="folders" type="string[]">
  An array of folder prefixes found at the current level. Only present when a `delimiter` is specified.
</ResponseField>

<ResponseField name="total" type="integer">
  The total number of files matching the query.
</ResponseField>

<ResponseField name="page" type="integer">
  The current page number.
</ResponseField>

<ResponseField name="limit" type="integer">
  The number of files per page.
</ResponseField>
