Google: Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified
Google driveFiles.driveFilesModifyLabels: arguments, response, policy and SDK examples.
← Drive files operations · Get started
Operation google.drive_files_modifylabels
Provider route: POST /drive/v3/files/{fileId}/modifyLabels. 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"]["driveFilesModifyLabels"]>[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.driveFilesModifyLabels(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_modify_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 of the file to which the labels belong. |
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. |
body | Model | Required within parent | Expand Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
Schemas
Section titled “Schemas”Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Response to a `ModifyLabels` request. This contains only those labels which were added or updated by the request. |
kind | string | Optional | This is always `"drive#modifyLabelsResponse"`. |
modifiedLabels | array | Optional | The list of labels which were added or updated by the request. |
modifiedLabels[] | 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 |
Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A request to modify the set of labels on a file. This request may contain many modifications that will either all succeed or all fail atomically. |
kind | string | Optional | This is always `"drive#modifyLabelsRequest"`. |
labelModifications | array | Optional | The list of modifications to apply to the labels on the file. |
labelModifications[] | Model | Each item | Expand Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body label Modifications item |
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. |
Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body label Modifications item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A modification to a label on a file. A `LabelModification` can be used to apply a label to a file, update an existing label on a file, or remove a label from a file. |
fieldModifications | array | Optional | The list of modifications to this label's fields. |
fieldModifications[] | Model | Each item | Expand Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body label Modifications item field Modifications item |
kind | string | Optional | This is always `"drive#labelModification"`. |
labelId | string | Required within parent | The ID of the label to modify. |
removeLabel | boolean | Optional | If true, the label will be removed from the file. |
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` |
Modifies the set of labels applied to a file For more information, see Set a label field on a file (https: developers google com workspace drive api guides set-label) Returns a list of the labels that were added or modified — request body — body label Modifications item field Modifications item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A modification to a label's field. |
fieldId | string | Optional | The ID of the field to be modified. |
kind | string | Optional | This is always `"drive#labelFieldModification"`. |
setDateValues | array | Optional | Replaces the value of a dateString Field with these new values. The string must be in the RFC 3339 full-date format: YYYY-MM-DD. |
setDateValues[] | string | Each item | Format: date |
setIntegerValues | array | Optional | Replaces the value of an `integer` field with these new values. |
setIntegerValues[] | string | Each item | Format: int64 |
setSelectionValues | array | Optional | Replaces a `selection` field with these new values. |
setSelectionValues[] | string | Each item | |
setTextValues | array | Optional | Sets the value of a `text` field. |
setTextValues[] | string | Each item | |
setUserValues | array | Optional | Replaces a `user` field with these new values. The values must be a valid email addresses. |
setUserValues[] | string | Each item | |
unsetValues | boolean | Optional | Unsets the values for this field. |
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_modifylabels. Catalog operation: drive.files.modifyLabels. 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.metadata"]