Sensitivity labels api

Andreas Davros 71 Reputation points
2025-12-01T22:25:05.4166667+00:00

Hello!

We noticed that to assign a sensitivity label through graph API we need Enable metered APIs and services in Microsoft Graph.

On the contrary, to get the sensitivity label of a file through graph API there is no mention to the metered APIs.

Is it safe to assume enabling metered APIs is not a requirement to get the label of a file..?

Thank you!

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. TiNo-T 8,910 Reputation points Microsoft External Staff Moderator
    2025-12-02T02:38:24.3233333+00:00

    Dear @Andreas Davros

    Welcome to Microsoft Q&A Forum!

    Thanks for the thoughtful question and documentation can cause confusion here, so let me give you some insights based on my research:

    • Assigning a label to a SharePoint/OneDrive file uses driveItem: assignSensitivityLabel, which is an advanced, protected, and metered API. You must enable Metered APIs and services for the calling app (Azure subscription linked to the app), and the app needs permissions like Files.ReadWrite.All/Sites.ReadWrite.All. It may be considered a write operation that uses advanced compliance features. These operations fall under metered APIs because they consume additional compliance resources and may incur throttling or billing implications.
    • Reading sensitivity labels (retrieving metadata) is a read-only operation. It typically does not require metered API enablement, as it doesn’t trigger compliance processing or classification logic. Reading a label uses driveItem: extractSensitivityLabels. This is a standard read operation, not listed as metered, and works with Files.Read.All (or higher) without the metered setup.

    So, in this concern:

    • Enabling metered APIs is required for assigning labels because it’s a premium compliance feature.
    • Enabling metered APIs is not required for reading labels; you can retrieve sensitivity label info without enabling metered APIs.
    • If you only need to get labels: use extractSensitivityLabels; confirm supported file types (Office + PDF) and permissions.
    • If you need to set labels: ensure Purview labels are published and SP/OD labeling is enabled; then enable Metered APIs and call assignSensitivityLabel.

    Official references:

    Hope this helps and please feel free to let me know any questions in comment sections. Wish you a pleasant day!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-01T22:25:16.1166667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Yes, it is safe to assume that enabling metered APIs is not a requirement to get the sensitivity label of a file through the Microsoft Graph API. The documentation does not mention any metering requirements for the extractSensitivityLabels API, which indicates that it can be accessed without needing to enable metered APIs. In contrast, the assignSensitivityLabel API specifically requires metered APIs to be enabled, as noted in the context provided.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.