canonical: https://jentic.com/apis/googleapis.com/google-drive

# Google Drive API

Upload, download, search, and organize files and folders in Google Drive with fine-grained sharing permissions and real-time collaboration metadata. Access 58 endpoints covering file operations, shared drives, permission management, revision history, and change tracking across personal and team drives. Supports resumable uploads for files up to 5 TB and real-time change subscriptions via push notifications.

## For AI agents

Upload, download, search, and share files in Google Drive. Manage permissions, track revisions, and monitor file changes across personal and shared drives with 58 available operations.

## Scope

Does not handle document editing, spreadsheet formulas, or email - use for file storage, sharing, and organization only.

## Capabilities

- Upload files with resumable transfer supporting documents up to 5 TB
- Search files using structured queries with field-specific filters and full-text content matching
- Share files and folders with granular permission roles including reader, commenter, writer, and organizer
- Track file revision history and restore previous versions of any document
- Monitor real-time file changes across a drive with push notification subscriptions
- Organize content into shared drives with team-level access controls and storage policies
- Export Google Workspace documents to standard formats like PDF, DOCX, and CSV

## Use cases

### AI Agent File Management

AI agents use the Google Drive API through Jentic to store outputs, retrieve reference documents, and share generated content with stakeholders. An agent searches Jentic for 'upload a file to Google Drive,' receives the multipart upload schema, and executes the operation with proper MIME type detection - no manual OAuth token management required. Supports files up to 5 TB with resumable uploads for reliability.

Example prompt: Upload a PDF report file to a specific folder in Google Drive using POST /files with uploadType=resumable, then share it with viewer access to team@company.com

### Document Search and Retrieval

Query Google Drive using structured search with filters for file type, owner, date modified, shared status, and full-text content. The files.list endpoint accepts a 'q' parameter supporting operators like 'contains', 'in', and date comparisons. Results include file metadata, download links, and sharing status for immediate access or downstream processing by agents.

Example prompt: Search for all spreadsheet files modified after 2024-06-01 owned by finance@company.com using GET /files with query 'mimeType="application/vnd.google-apps.spreadsheet" and modifiedTime > "2024-06-01T00:00:00"'

### Permission and Sharing Automation

Programmatically manage file and folder sharing permissions across an organization. The permissions endpoints support setting role-based access (reader, writer, commenter, organizer) for users, groups, domains, or public links. Includes transfer of ownership, expiration dates on shared links, and batch permission updates across multiple files.

Example prompt: Create a permission on a file granting 'writer' role to user@partner.com with an expiration date of 2024-12-31 using POST /files/{fileId}/permissions

### Change Tracking and Sync

Subscribe to real-time change notifications for files and shared drives using the changes.watch endpoint with push delivery to a webhook URL. Poll for incremental changes since the last sync token to keep local systems synchronized with Drive state. Tracks file creation, modification, deletion, permission changes, and moves across the entire drive hierarchy.

Example prompt: Get the start page token using GET /changes/startPageToken, then subscribe to changes using POST /changes/watch with a webhook callback URL for real-time file change notifications

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /files | List and search files with query filtering |
| POST | /files | Upload a new file or create metadata |
| GET | /files/{fileId} | Get file metadata or download content |
| PATCH | /files/{fileId} | Update file metadata or content |
| DELETE | /files/{fileId} | Permanently delete a file |
| POST | /files/{fileId}/permissions | Create a sharing permission |
| POST | /changes/watch | Subscribe to file change notifications |
| GET | /files/{fileId}/revisions | List file revision history |

## Key resources

- **Files** — Upload, download, copy, move, search, and export files with metadata and content access
- **Permissions** — Create, list, update, and delete sharing permissions with role-based access control
- **Revisions** — List, get, update, and delete file revision history
- **Changes** — Track incremental changes and subscribe to push notifications
- **Drives** — Create, list, update, hide, and delete shared drives
- **Comments** — Create and manage comments and replies on files

## Why Jentic

- **Setup:** Wiring the Google Drive API by hand means standing up Google OAuth2 with the right scopes, targeting the Google Drive host, and building the file, permission, and revision calls yourself. Through Jentic you install once, import the Google Drive API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Google Drive puts the file id in the URL path (/files/{fileId}/...), so a rule can pin your agent to one file: it can read and update that file and nothing else. You choose the operations it may call, so destructive ones like deleting a file are not included unless you add them.
- **Credential handling:** Your Google OAuth credential for Google Drive is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'list files in Drive' or 'share a file with a user', and Jentic returns the matching Google Drive operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Dropbox API** — Cloud file storage with folder sharing, file versioning, and content-based search
- **Box API** — Enterprise content management with advanced governance, compliance, and workflow automation
- **Google Sheets API** — Read and write spreadsheet data stored in Google Drive
- **Gmail API** — Email messaging for sharing Drive file links and processing attachments

## FAQ

### What authentication does the Google Drive API use?

The Google Drive API uses OAuth 2.0 with scopes ranging from metadata-only access (drive.metadata.readonly) to full drive control (drive). Through Jentic, OAuth tokens are stored in your Jentic One instance and agents receive scoped access tokens. The API supports both Oauth2 implicit flow and Oauth2 authorization code flow for server-side applications.

### Can I search files by content, type, and owner with the Google Drive API?

Yes, the GET /files endpoint accepts a 'q' parameter with a structured query language. You can combine operators like mimeType='application/pdf', 'report' in name, modifiedTime > '2024-01-01', and 'user@example.com' in owners. Full-text content search uses the fullText contains operator to search within document bodies.

### What are the rate limits for the Google Drive API?

The Google Drive API allows 12,000 queries per 60 seconds per project, and 12 queries per second per user. File uploads support resumable uploads for files up to 5 TB. Batch requests can combine up to 100 API calls in a single HTTP request to reduce quota consumption.

### How do I upload large files to Google Drive through Jentic?

Search Jentic for 'upload file to Google Drive' to get the POST /files operation schema with uploadType=resumable. This initiates a resumable upload session that supports files up to 5 TB with automatic retry on network failures. Install Jentic with pip install jentic, authenticate through Jentic One, the self-hosted execution layer, and execute the upload with multipart content type.

### Is the Google Drive API free to use?

The API itself is free with no per-call charges. Storage usage counts against the Google account's storage quota (15 GB free for personal accounts, varies for Workspace). API usage is governed by per-project and per-user rate limits rather than pricing tiers.

### Can I track file changes in real-time with the Google Drive API?

Yes, use the POST /changes/watch endpoint to subscribe to push notifications delivered to your webhook URL. First get a start token via GET /changes/startPageToken, then watch for changes including file creation, modification, deletion, and permission updates. Watch subscriptions expire after a configurable period and need renewal.

### How do I export Google Docs to PDF or other formats?

Use GET /files/{fileId}/export with the mimeType parameter set to the target format. Google Docs export to application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document (DOCX), text/plain, and other formats. Spreadsheets export to CSV, XLSX, and PDF. The export endpoint works only for Google Workspace native formats.

### Can I limit what my agent is allowed to do with the Google Drive API?

Yes. Because you run Jentic One yourself, you decide which Google Drive operations your agent may call and which stored OAuth credential it uses. Since Google Drive puts the file id in the URL path (/files/{fileId}/...), a rule can pin your agent to a single file so it can read and update only that file and nothing else. Destructive operations like deleting a file (DELETE /files/{fileId}) are excluded unless you explicitly add them to what the agent is allowed to run.
