Skip to main content

Overview

The Google Drive API allows you to manage files, folders, shared drives, permissions, and more. This service provides programmatic access to Google Drive’s file storage and collaboration features. API Name: drive
Version: v3
Official Documentation: Google Drive API Reference

Common Resources

Files

Manage files and folders in Google Drive.
fileId
string
required
The ID of the file or folder
q
string
Search query to filter files (e.g., "name contains 'report'")
pageSize
integer
Maximum number of files to return per page (default: 100, max: 1000)
fields
string
Specify which fields to return (e.g., "files(id,name,mimeType)")

Permissions

Manage sharing permissions for files and folders.
fileId
string
required
The ID of the file to share
type
string
required
The type of permission: user, group, domain, or anyone
role
string
required
The role: owner, organizer, fileOrganizer, writer, commenter, or reader

Drives (Shared Drives)

Manage shared drives for team collaboration.
driveId
string
required
The ID of the shared drive

Common Methods

List Files

gws drive files list --params '{"pageSize": 10}'
files
array
Array of file metadata objects
id
string
The file ID
name
string
The file name
mimeType
string
The MIME type of the file
createdTime
string
Creation timestamp (RFC 3339)

Get File Metadata

gws drive files get --params '{"fileId": "1a2b3c4d5e"}'

Create a Folder

gws drive files create --json '{
  "name": "My Folder",
  "mimeType": "application/vnd.google-apps.folder"
}'

Upload a File

gws drive files create \
  --json '{"name": "report.pdf"}' \
  --upload ./report.pdf

Share a File

gws drive permissions create \
  --params '{"fileId": "1a2b3c4d5e"}' \
  --json '{
    "type": "user",
    "role": "writer",
    "emailAddress": "colleague@example.com"
  }'

Search Files

gws drive files list --params '{
  "q": "name contains \"budget\"",
  "pageSize": 20
}'

Response Format

All responses are returned as JSON:
{
  "kind": "drive#fileList",
  "files": [
    {
      "id": "1a2b3c4d5e",
      "name": "Q1 Budget.xlsx",
      "mimeType": "application/vnd.google-apps.spreadsheet",
      "createdTime": "2026-01-15T10:30:00.000Z",
      "modifiedTime": "2026-03-01T14:22:00.000Z"
    }
  ],
  "nextPageToken": "abc123..."
}

Key Resources

  • files - Create, read, update, delete files and folders
  • permissions - Manage sharing permissions
  • drives - Manage shared drives
  • comments - Add and manage comments
  • revisions - Access file revision history
  • changes - Track changes to files

Learn More

Schema Inspection

Before calling any method, inspect its schema:
gws schema drive.files.list
gws schema drive.permissions.create