List labels on a file

Stay organized with collections Save and categorize content based on your preferences.

Your organization can have multiple labels, with labels having any number of fields. This page describes how to list all labels on a single Google Drive file. To list the file labels, use the files.listLabels method.

You also need to specify:

  • The fileId of the file for which you want the list of labels.

This example uses the label fileId to retrieve the correct labels.


List<Label> labelList =


label_list_response = drive_service.files().listLabels(fileId="FILE_ID");


* Lists all the labels on a Drive file
* @return{obj} a list of Labels
async function modifyLabelTextField() {
  // Get credentials and build service
  // TODO (developer) - Use appropriate auth mechanism for your app

  const {GoogleAuth} = require('google-auth-library');
  const {google} = require('googleapis');

  const auth = new GoogleAuth({scopes: ''});
  const service ={version: 'v3', auth});
  try {
    const labelListResponse = await service.files.listLabels({
      fileId: 'FILE_ID',
    return labelListResponse;
  } catch (err) {
    // TODO (developer) - Handle error
    throw err;