Google Drive API logo

Google Drive API

Interact with Google Drive to list files and track changes. This API lets you search, filter, and monitor files and changes in a user's or shared drive.

v1.0.04 methods

Methods

Each method below is pulled directly from the OpenAPI file.

GET/changeschanges_list

Lists all changes (file modifications, deletions, additions) that have occurred in Drive **since a given start page token**. **To list files changed since a specific date:** 1. First, call `/changes/startPageToken` at or just after your desired date to obtain a token. 2. Use the returned token as the `pageToken` parameter in this endpoint. 3. Each change entry includes the file and the time of the change; filter or process these results as needed. **Important:** The `pageToken` parameter must be a valid token from `/changes/startPageToken`, not a date string.

Google Drive API logo

Parameters

driveIdquery

The shared drive from which changes will be returned. If specified, change IDs will be reflective of the shared drive.

includeCorpusRemovalsquery

Whether to include file resources that are still accessible even after removal from the list of changes.

includeItemsFromAllDrivesquery

Whether to include items from both My Drive and shared drives.

includeRemovedquery

Whether to include changes indicating items have been removed (e.g., deleted or lost access).

pageSizequery

Maximum number of changes to return per page.

pageTokenquery

Token for continuing a previous list request (from `nextPageToken` or `/changes/startPageToken`). This must be a valid token, not a date string.

restrictToMyDrivequery

Restrict results to changes inside the My Drive hierarchy.

spacesquery

Comma-separated list of spaces to query within the corpora. Supported: `drive`, `appDataFolder`.

supportsAllDrivesquery

Whether the application supports both My Drives and shared drives.

includePermissionsForViewquery

Specifies which additional view's permissions to include. Only `published` is supported.

includeLabelsquery

Comma-separated list of label IDs to include in the response.

Responses

200

A list of changes for a user or shared drive. Each change includes the file, the type of change, and the time it occurred. Use this endpoint to list files changed since a specific date (using a valid page token).

GET/changes/startPageTokenchanges_startPageToken

Returns a token representing the current state of Drive. **To list all changes (such as file modifications, deletions, or additions) that occur after a specific date:** 1. Call this endpoint at or just after your desired start date (e.g., "2025-06-01") to obtain a start page token. 2. Save the returned token for use with the `/changes` endpoint. **Note:** The API does not accept a date string to fetch changes; you must use a valid token from this endpoint. **Workflow Example:** - On 2025-06-01, call `/changes/startPageToken` and save the `startPageToken` value. - Later, call `/changes` with `pageToken` set to this value to retrieve all changes since that time.

Google Drive API logo

Responses

200

Start page token for change tracking.

GET/filesfiles_list

Lists files the user has access to. Supports advanced filtering, sorting, and pagination. Use the `q` parameter for powerful search queries (e.g., `name contains 'bionic'`). **Note:** This endpoint lists current files and their metadata, but does **not** provide change history or timestamps of when files were changed. For queries about files changed since a specific date, see the `/changes` endpoint and the workflow below.

Google Drive API logo

Parameters

qquery

A query string for filtering the file results. Example: `name contains 'bionic'`.

corporaquery

Bodies of items to which the query applies. Example: `user`.

driveIdquery

ID of the shared drive to search.

includeItemsFromAllDrivesquery

Whether to include items from both My Drive and shared drives.

orderByquery

Comma-separated list of sort keys. Example: `modifiedTime desc`.

pageSizequery

Maximum number of files to return per page (1-1000).

pageTokenquery

Token for continuing a previous list request.

spacesquery

Spaces to query within the corpora. Example: `drive`.

fieldsquery

Selector specifying which fields to include in a partial response.

Responses

200

A list of files matching the query.

GET/files/{fileId}files_get

Retrieves the metadata or content of a specific file in Google Drive using its unique file ID. By default, only metadata is returned unless the `alt=media` parameter is specified, in which case the file's content is downloaded. **Typical Use Cases:** - Obtain file details (name, mime type, modified time, etc.) for display or further processing. - Download file content directly if the file is not a native Google Doc format. **File Content Download Workflow:** - To download binary or textual content, set `alt=media`. - For Google Workspace documents (Docs, Sheets, Slides), use the export endpoint or API export mechanism. **Permissions Required:** - The requester must have access to the file and appropriate OAuth scopes. **Usage Example (Metadata):** `GET /files/1A2B3C4D?fields=id,name,mimeType` **Usage Example (Download):** `GET /files/1A2B3C4D?alt=media`

Google Drive API logo

Parameters

fileIdpathrequired

The unique ID of the file in Google Drive.

fieldsquery

Selector specifying which fields to include in a partial response.

altquery

Set to `media` to download file content instead of metadata (for binary/text files).

acknowledgeAbusequery

Whether the user is acknowledging the risk of downloading a file flagged as abusive.

Responses

200

File metadata in JSON format, or file content if `alt=media` is used.

404

File not found or access not permitted.

YAML

Copy and paste the full spec from the textarea below.