Stay organized with collectionsSave and categorize content based on your preferences.
Your organization can have multiple labels, with labels having several fields.
The Labels API provides thelabelscollection to enable the
reading of labels.
This page describes how to search for and retrieve labels.
Methods
Thelabelscollection provides the
following methods for reading label values, each with a specific task in mind:
To get a single label by its resource name, use thelabels.getmethod.
A label resource name is required and can be structured as:
labels/{id}orlabels/{id}@latest—Gets the latest label revision.
labels/{id}@published—Gets the current published label revision.
labels/{id}@{revisionId}—Gets the label at the specified revision ID.
You also must specify:
LabelViewisLABEL_VIEW_FULLto set the Resource view applied to label responses.LABEL_VIEW_FULLreturns all possible fields.
This example uses theNameto get a single label by its resource name.
Python
# Label name, with or without revision:## Revision specified:# labels/LABEL_ID@published# labels/LABEL_ID@latest# labels/LABEL_ID@1## No revision specified, returns latest revision:# labels/LABEL_IDname="labels/NAME@published"# Label view controls level of data in responseview='LABEL_VIEW_FULL'label=service.labels().get(name=name,view=view).execute()
Node.js
#Labelname,withorwithoutrevision:##Revisionspecified:#labels/LABEL_ID@published#labels/LABEL_ID@latest#labels/LABEL_ID@1##Norevisionspecified,returnslatestrevision:#labels/LABEL_IDname="labels/NAME@published"#Labelviewcontrolslevelofdatainresponseview='LABEL_VIEW_FULL'service.labels.get({'name':name,'view':view},(err,res)=>{if(err)returnconsole.error('The API returned an error: '+err);console.log(res);});
List all labels
To get a list of labels, use thelabels.listmethod.
You also must specify:
Acustomerto scope this
list request to. Ifcustomeris unset, all labels within the current
customer are returned.
LabelViewisLABEL_VIEW_FULLto set the Resource view applied to label responses.LABEL_VIEW_FULLreturns all possible fields.
This example uses theCUSTOMERto retrieve the label list.
constparams={'customer':'customers/CUSTOMER','view':'LABEL_VIEW_FULL'};service.labels.list(params,(err,res)=>{if(err)returnconsole.error('The API returned an error: '+err);constlabels=res.data.labels;if(labels){labels.forEach((label)=>{constname=label.name;consttitle=label.properties.title;console.log(`${name}\t${title}`);});}else{console.log('No Labels');}});
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Search for labels\n\nYour organization can have multiple labels, with labels having several fields.\nThe Labels API provides the\n[`labels`](/workspace/drive/labels/reference/rest/v2/labels) collection to enable the\nreading of labels.\n\nThis page describes how to search for and retrieve labels.\n\nMethods\n-------\n\nThe [`labels`](/workspace/drive/labels/reference/rest/v2/labels) collection provides the\nfollowing methods for reading label values, each with a specific task in mind:\n\n| Range | Reading |\n|-------------------------------|----------------------------------------------------------------------|\n| Single label by resource name | [labels.get](/workspace/drive/labels/reference/rest/v2/labels/get) |\n| All labels | [labels.list](/workspace/drive/labels/reference/rest/v2/labels/list) |\n\nGet label by resource name\n--------------------------\n\nTo get a single label by its resource name, use the\n[`labels.get`](/workspace/drive/labels/reference/rest/v2/labels/get) method.\n\nA label resource name is required and can be structured as:\n\n- `labels/{id}` or `labels/{id}@latest`---Gets the latest label revision.\n- `labels/{id}@published`---Gets the current published label revision.\n- `labels/{id}@{revisionId}`---Gets the label at the specified revision ID.\n\nYou also must specify:\n\n- [`LabelView`](/workspace/drive/labels/reference/rest/v2/LabelView) is `LABEL_VIEW_FULL` to set the Resource view applied to label responses. `LABEL_VIEW_FULL` returns all possible fields.\n\nThis example uses the `Name` to get a single label by its resource name. \n\n### Python\n\n # Label name, with or without revision:\n #\n # Revision specified:\n # labels/LABEL_ID@published\n # labels/LABEL_ID@latest\n # labels/LABEL_ID@1\n #\n # No revision specified, returns latest revision:\n # labels/LABEL_ID\n\n name = \"labels/\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e@published\"\n\n # Label view controls level of data in response\n view = 'LABEL_VIEW_FULL'\n\n label = service.labels().get(name=name, view=view).execute()\n\n### Node.js\n\n # Label name, with or without revision:\n #\n # Revision specified:\n # labels/LABEL_ID@published\n # labels/LABEL_ID@latest\n # labels/LABEL_ID@1\n #\n # No revision specified, returns latest revision:\n # labels/LABEL_ID\n\n name = \"labels/\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e@published\"\n\n # Label view controls level of data in response\n view = 'LABEL_VIEW_FULL'\n\n service.labels.get({\n 'name': name,\n 'view': view\n }, (err, res) =\u003e {\n if (err) return console.error('The API returned an error: ' + err);\n console.log(res);\n });\n\nList all labels\n---------------\n\nTo get a list of labels, use the\n[`labels.list`](/workspace/drive/labels/reference/rest/v2/labels/list) method.\n\nYou also must specify:\n\n- A [`customer`](/workspace/drive/labels/reference/rest/v2/labels/list) to scope this\n list request to. If `customer` is unset, all labels within the current\n customer are returned.\n\n- [`LabelView`](/workspace/drive/labels/reference/rest/v2/LabelView) is\n `LABEL_VIEW_FULL` to set the Resource view applied to label responses.\n `LABEL_VIEW_FULL` returns all possible fields.\n\nThis example uses the `CUSTOMER` to retrieve the label list. \n\n### Python\n\n response = service.labels().list(\n customer='customers/\u003cvar translate=\"no\"\u003eCUSTOMER\u003c/var\u003e', view='LABEL_VIEW_FULL').execute()\n\n### Node.js\n\n const params = {\n 'customer': 'customers/\u003cvar translate=\"no\"\u003eCUSTOMER\u003c/var\u003e',\n 'view': 'LABEL_VIEW_FULL'\n };\n\n service.labels.list(params, (err, res) =\u003e {\n if (err) return console.error('The API returned an error: ' + err);\n const labels = res.data.labels;\n if (labels) {\n labels.forEach((label) =\u003e {\n const name = label.name;\n const title = label.properties.title;\n console.log(`${name}\\t${title}`);\n });\n } else {\n console.log('No Labels');\n }\n });\n\n| **Note:** If you wish to return only the published label revisions, you can also specify [`publishedOnly`](/workspace/drive/labels/reference/rest/v2/labels/list) is `true`. The results also include disabled labels."]]