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

# files_list

> List the user's files. Returns all files by default, including trashed files; add `trashed = false` to `q` to hide them. `q` is Drive's search grammar — `name contains 'Q3' and mimeType = 'application/vnd.google-apps.folder'`.

<div className="tool-route"><span className="tool-row-method" data-method="GET">GET</span><code>{"https://www.googleapis.com/drive/v3/files"}</code></div>

```python gdrive_files_list.py theme={null}
from charter.packs import gdrive

result = await gdrive.files_list.ainvoke({})
```

<Note>
  Requires `https://www.googleapis.com/auth/drive`. Pages by cursor: `nextPageToken` is sent back as `pageToken`. Costs 1 against the provider's own quota.
</Note>

## Query parameters

<div className="reference-table">
  | Field                       | Type                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
  | --------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | `q`                         | `string`                                               | A query for filtering the file results. For supported syntax, see Search for files and folders. This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use `trashed = false` in `q`.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
  | `pageSize`                  | `integer`                                              | The maximum number of files to return. The service may return fewer than this value. If unspecified, at most 100 files will be returned for shared drives, and the entire list of files for non-shared drives. The maximum value is 1000; values above 1000 will be coerced to 1000. <span className="field-constraints">≥ 1; ≤ 1000</span>                                                                                                                                                                                                                                                                                                                                                                |
  | `pageToken`                 | `string`                                               | The token for continuing a previous list request on the next page. This should be set to the value of `nextPageToken` from the previous response.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | `corpora`                   | [Corpora](/charter/charter/packs/gdrive/files/objects#corpora) | Specifies a collection of items (files or documents) to which the query applies. Supported items include: `user`, `domain`, `drive`, `allDrives`. Prefer `user` or `drive` to `allDrives` for efficiency. By default, corpora is set to `user`. However, this can change depending on the filter set through the `q` parameter. If `driveId` is specified, corpora must be `drive`.                                                                                                                                                                                                                                                                                                                        |
  | `driveId`                   | `string`                                               | ID of the shared drive to search.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | `orderBy`                   | `string`                                               | A comma-separated list of sort keys. Valid keys are: `createdTime` (when the file was created; avoid using this key for queries on large item collections as it might result in timeouts or other issues; for time-related sorting on large item collections, use `modifiedTime desc` instead); `folder` (the folder ID, sorted using alphabetical ordering); `modifiedByMeTime`; `modifiedTime`; `name` (alphabetical, so 1, 12, 2, 22); `name_natural` (natural sort, so 1, 2, 12, 22); `quotaBytesUsed`; `recency`; `sharedWithMeTime`; `starred`; `viewedByMeTime`. Each key sorts ascending by default, but can be reversed with the `desc` modifier. Example usage: `folder,modifiedTime desc,name`. |
  | `spaces`                    | `string`                                               | A comma-separated list of spaces to query within the corpora. Supported values are `drive` and `appDataFolder`. If omitted, the server queries the `drive` space.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | `includeItemsFromAllDrives` | `boolean`                                              | Whether both My Drive and shared drive items should be included in results.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
  | `includePermissionsForView` | `string`                                               | Specifies which additional view's permissions to include in the response. Only `published` is supported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | `includeLabels`             | `string`                                               | A comma-separated list of IDs of labels to include in the `labelInfo` part of the response.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
  | `supportsAllDrives`         | `boolean`                                              | Whether the requesting application supports both My Drives and shared drives.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
</div>
