Edit

Share via


List sensitivityLabels

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

List the sensitivity labels available for the entire tenant.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) SensitivityLabel.Read SensitivityLabels.Read.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application SensitivityLabel.Read SensitivityLabels.Read.All

When using application permissions (SensitivityLabels.Read.All), the API returns all labels for the tenant by default.

HTTP request

Get labels available in the tenant:

GET /security/dataSecurityAndGovernance/sensitivityLabels

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Client-Request-Id Optional. A client-generated GUID to trace the request. Recommended for troubleshooting.

Optional query parameters

This method supports some of the OData query parameters to help customize the response. For general information, see OData query parameters.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a collection of sensitivityLabel objects in the response body.

Examples

Get tenant labels filtered by content format and ID with an application permission.

Request

The following example shows a request to get labels for the tenant, filtered for the File content format and specific IDs.

GET https://graph.microsoft.com/beta/security/dataSecurityAndGovernance/sensitivityLabels?$filter=applicableTo has 'File' and id in ('4e4234dd-377b-42a3-935b-0e42f138fa23','b7a21bba-8197-491f-a5d6-0d0f955397ca')
Authorization: Bearer {token}
Client-Request-Id: a0b9c8d7-e6f5-a4b3-c2d1-e0f9a8b7c6d5

Response

The following example shows the response containing only the labels matching the filters.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#security/dataSecurityAndGovernance/sensitivityLabel",
  "value": [
    {
      "id": "4e4234dd-377b-42a3-935b-0e42f138fa23",
      "name": "General",
      "description": "General data, not for public use.",
      "color": "#000000",
      "priority": 10,
      "toolTip": "Apply this label to general non-public data.",
      "isEnabled": true,
      "isEndpointProtectionEnabled": true,
      "autoTooltip": "",
      "actionSource": "manual",
      "applicableTo": "email,teamwork,file",
      "sublabels": []
    }
  ]
}