Google: Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels)
Google driveFiles.driveFilesListLabels: arguments, response, policy and SDK examples.
← Drive files operations · Get started
Operation google.drive_files_listlabels
Provider route: GET /drive/v3/files/{fileId}/listLabels. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/google with npm, or alter-sdk-google with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GoogleIntegration } from "@alter-ai/google";
async function execute(input: Parameters<GoogleIntegration["driveFiles"]["driveFilesListLabels"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GoogleIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.driveFiles.driveFilesListLabels(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_google import GoogleIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GoogleIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.drive_files.drive_files_list_labels(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.fileId | string | Required within parent | The ID for the file. |
query | object | Optional | Additional keys: not allowed |
query.fields | string | Optional | Selector specifying which fields to include in a partial response. |
query.prettyPrint | boolean | Optional | Returns response with indentations and line breaks. Default: true |
query.quotaUser | string | Optional | Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. |
query.maxResults | integer | Optional | The maximum number of labels to return per page. When not set, defaults to 100. Default: 100 Format: int32 Maximum: 100 Minimum: 1 |
query.pageToken | string | Optional | The token for continuing a previous list request on the next page. This should be set to the value of `nextPageToken` from the previous response. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body |
Referenced models: Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body
Schemas
Section titled “Schemas”Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A list of labels applied to a file. |
kind | string | Optional | This is always `"drive#labelList"`. |
labels | array | Optional | The list of labels. |
labels[] | Model | Each item | Expand Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body — labels item |
nextPageToken | string | Optional | The page token for the next page of labels. This field will be absent if the end of the list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results. The page token is typically valid for several hours. However, if new items are added or removed, your expected results might differ. |
Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body — labels item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Representation of label and label fields. |
fields | object | Optional | A map of the fields on the label, keyed by the field's ID. Additional keys: see wildcard field |
fields.* | Model | Additional keys | Expand Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body — labels item fields value |
id | string | Optional | The ID of the label. |
kind | string | Optional | This is always drive#label |
revisionId | string | Optional | The revision ID of the label. |
Lists the labels on a file For more information, see List labels on a file (https: developers google com workspace drive api guides list-labels) — response body — labels item fields value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Representation of field, which is a typed key-value pair. |
dateString | array | Optional | Only present if valueType is dateString. RFC 3339 formatted date: YYYY-MM-DD. |
dateString[] | string | Each item | Format: date |
id | string | Optional | The identifier of this label field. |
integer | array | Optional | Only present if `valueType` is `integer`. |
integer[] | string | Each item | Format: int64 |
kind | string | Optional | This is always drive#labelField. |
selection | array | Optional | Only present if `valueType` is `selection` |
selection[] | string | Each item | |
text | array | Optional | Only present if `valueType` is `text`. |
text[] | string | Each item | |
user | array | Optional | Only present if `valueType` is `user`. |
user[] | Model | Each item | Expand Gets information about the user, the user's Drive, and system capabilities. For more information, see [Return user info](https://developers.google.com/workspace/drive/api/guides/user-info). Required: The `fields` parameter must be set To return the exact fields you need, see Return specific fields (https: developers google com workspace drive api guides fields-parameter) — response body — user |
valueType | string | Optional | The field type. While new values may be supported in the future, the following are currently allowed: * `dateString` * `integer` * `selection` * `text` * `user` |
Gets information about the user, the user's Drive, and system capabilities. For more information, see [Return user info](https://developers.google.com/workspace/drive/api/guides/user-info). Required: The `fields` parameter must be set To return the exact fields you need, see Return specific fields (https: developers google com workspace drive api guides fields-parameter) — response body — user
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Information about a Drive user. |
displayName | string | Optional | Output only. A plain text displayable name for this user. Read only: true |
emailAddress | string | Optional | Output only. The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. Read only: true |
kind | string | Optional | Output only. Identifies what kind of resource this is. Value: the fixed string `drive#user`. Default: drive#user Read only: true |
me | boolean | Optional | Output only. Whether this user is the requesting user. Read only: true |
permissionId | string | Optional | Output only. The user's ID as visible in Permission resources. Read only: true |
photoLink | string | Optional | Output only. A link to the user's profile photo, if available. Read only: true |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: google.drive_files_listlabels. Catalog operation: drive.files.listLabels. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.meet.readonly", "https://www.googleapis.com/auth/drive.metadata", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]