> For the complete documentation index, see [llms.txt](https://docs.docontrol.io/docontrol-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docontrol.io/docontrol-user-guide/best-practices/google-labels/google-drive-labels/apply-labels-automatically.md).

# Apply labels automatically

If your Google Workspace edition supports data loss prevention (DLP) for Drive, you can [set up rules to automatically apply labels](https://support.google.com/a/answer/13127870#dlp) to content created by certain users and block sharing of content with specific labels (DLP).

If your edition supports [Google Vault](https://support.google.com/vault/answer/7657465?fl=1\&sjid=12308467716317648070-NA), you can set Drive retention rules to add labels and meet compliance requirements, using fine-grained retention policies and configurable label conditions.

There are 2 methods of applying Google labels automatically:

* [DLP rules](#dlp-rules) - Use Google Workspace DLP to define rules based on your company's policies
* [Al classification](#ai-classification-beta) - Configure data training for Google to automatically label your company files

{% hint style="info" %}
**For example**: If a file contains PII, you can automatically apply a Confidential label and block external sharing. When you use a label in a rule, the label is locked, and cannot be disabled or deleted.
{% endhint %}

## DLP rules

As a Google administrator addressing your organization’s security needs, you can create DLP policies to automatically apply labels to Drive files:

* Using DLP rules, you can automatically apply classification labels to new or existing Drive files based on detection of sensitive content.
* These labels are automatically applied when a file is created or the owner of the file changes.
* You can set data classification policies by organizational unit or group, so different labels are applied to different sets of users or shared drives.
* Only labels with the Options list field type can be automatically applied to any Google Drive file in your organization.

{% hint style="info" %}
For example: If you want all files created by the Finance team to have a **Finance** label, you can automatically apply that label to all new content created by users in that group. You can also set a default field value for fields with a selection. For example, files created by the Finance team will automatically be tagged with the label **File Sensitivity = Confidential**.
{% endhint %}

**To set up automatic DLP classification:**

1. In Google Drive, open the [Labels Manager](https://drive.google.com/labels) and click the relevant label.
2. In the **Apply labels to new files** section, click **Set up**.
3. Follow the steps in [Apply classification labels to new files automatically](https://support.google.com/a/answer/11280938).

{% hint style="info" %}
To apply automatic classification with DLP rules, see [Google Workspace Admin Help](https://support.google.com/a/answer/9843931?hl=en\&ref_topic=9646660\&sjid=16517209147006475605-EU).
{% endhint %}

## AI classification (beta)

As a Google admin, you can define data training resulting in automatic classification and label creation powered by AI. This method is new and currently in beta.

Google’s AI classification uses artificial intelligence (AI) to automatically label your organization’s sensitive content. During an initial training period, the AI model learns your organization's criteria for sensitive content. Afterwards AI automatically applies labels to both new and existing files in your Google Drive.

To get started using AI classification:

1. [Set up training](https://support.google.com/a/answer/12676216?sjid=4675674402017854739-EU#setup) - Create classification labels, which the AI model will automatically apply to files once training is complete. You also create a training label, that's nearly identical to the classification label.
2. [Train the model](https://support.google.com/a/answer/12676216?sjid=4675674402017854739-EU#train_model) - Designate users at your organization as labelers who can evaluate sensitive files. During the training period, typically about a week, ask your designated labelers to classify Drive files with the training label. From their examples, your model begins to learn how to classify similarly sensitive files.
3. [Turn on automatic classification](https://support.google.com/a/answer/12676216?sjid=4675674402017854739-EU#turn_on_autoapply) - Once the model is trained, you're prompted to turn on automatic classification. You can monitor how many files are classified, and how accurately, on an ongoing basis.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docontrol.io/docontrol-user-guide/best-practices/google-labels/google-drive-labels/apply-labels-automatically.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
