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.
Methods
Each method below is pulled directly from the OpenAPI file.
/changeschanges_listLists 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.
Parameters
The shared drive from which changes will be returned. If specified, change IDs will be reflective of the shared drive.
Whether to include file resources that are still accessible even after removal from the list of changes.
Whether to include items from both My Drive and shared drives.
Whether to include changes indicating items have been removed (e.g., deleted or lost access).
Maximum number of changes to return per page.
Token for continuing a previous list request (from `nextPageToken` or `/changes/startPageToken`). This must be a valid token, not a date string.
Restrict results to changes inside the My Drive hierarchy.
Comma-separated list of spaces to query within the corpora. Supported: `drive`, `appDataFolder`.
Whether the application supports both My Drives and shared drives.
Specifies which additional view's permissions to include. Only `published` is supported.
Comma-separated list of label IDs to include in the response.
Responses
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).
/changes/startPageTokenchanges_startPageTokenReturns 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.
Responses
Start page token for change tracking.
/filesfiles_listLists 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.
Parameters
A query string for filtering the file results. Example: `name contains 'bionic'`.
Bodies of items to which the query applies. Example: `user`.
ID of the shared drive to search.
Whether to include items from both My Drive and shared drives.
Comma-separated list of sort keys. Example: `modifiedTime desc`.
Maximum number of files to return per page (1-1000).
Token for continuing a previous list request.
Spaces to query within the corpora. Example: `drive`.
Selector specifying which fields to include in a partial response.
Responses
A list of files matching the query.
/files/{fileId}files_getRetrieves 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`
Parameters
The unique ID of the file in Google Drive.
Selector specifying which fields to include in a partial response.
Set to `media` to download file content instead of metadata (for binary/text files).
Whether the user is acknowledging the risk of downloading a file flagged as abusive.
Responses
File metadata in JSON format, or file content if `alt=media` is used.
File not found or access not permitted.
YAML
Copy and paste the full spec from the textarea below.