Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Own-account API: sees what the Google user who granted the refresh token can see. drive.readonly is a restricted scope; an app used outside its own Google Workspace may need Google’s verification.
- Responses are minimal by default; set fields to get more than id, name and mimeType (and nextPageToken for paging).
- Google Docs, Sheets and Slides have no bytes to download; export them. Other files download with alt=media.
Endpoints
Search files
- Ask for nextPageToken in fields, or you cannot page. Shared-drive items need includeItemsFromAllDrives=true and supportsAllDrives=true.
Get file metadata
Download a file’s content
- Google Workspace files (Docs, Sheets, Slides) answer an error here; use files.export.
Export a Google Doc, Sheet or Slides file
- Exported content is limited to 10 MB.