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`
Parameters
Name | In | Required | Description |
---|
fileId | path | Yes | The unique ID of the file in Google Drive. |
fields | query | No | Selector specifying which fields to include in a partial response. |
alt | query | No | Set to `media` to download file content instead of metadata (for binary/text files). |
acknowledgeAbuse | query | No | Whether the user is acknowledging the risk of downloading a file flagged as abusive. |
Responses
Status | Description |
---|
200 | File metadata in JSON format, or file content if `alt=media` is used. |
404 | File not found or access not permitted. |