> For the complete documentation index, see [llms.txt](https://docs.material.security/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.material.security/working-with-issues/explorer/file-search.md).

# File Search

**Overview**

**File Search** helps you understand the sensitive data risk across files in your cloud office environment. When enabled, Material's File Search syncs file activity, classifies sensitive data, and helps you identify risky sharing patterns. Material provides out-of-the-box remediation tools for addressing these risks across your most sensitive files.

### File Search for Google Drive <a href="#h-file-search-for-google-drive" id="h-file-search-for-google-drive"></a>

If you have at least one enrolled Google tenant, you can configure Material to connect to your Google Drive environment. Material supports syncing and sensitive content analysis across both My Drives and Shared Drives, and shows its findings in File Search.

Once enabled, File Search starts indexing and analyzing your Google Drive environment. Material processes the most recent activity first, then works backward to build visibility across your Google Drive history. File Search syncs **6 months of historical activity starting from when you enable syncing**, plus **all new activity while syncing is enabled**.

Syncing times vary based on the size and complexity of your Google Drive. Because Material syncs the most recent activity first, you can usually start exploring results within an hour of enabling sync.

{% hint style="info" %}
File Search currently supports Google Drive only.
{% endhint %}

### Setup and Configuration <a href="#h-setup-configuration" id="h-setup-configuration"></a>

You can configure File Search manually, or by using the in-product setup guide the first time you visit File Search. Setting up File Search for Google Drive follows three basic steps:

1. [Granting Scopes](#h-granting-scopes)
2. [Enabling My Drive Syncing](#h-enabling-my-drive-syncing)
3. [Enabling Shared Drive Syncing](#h-enabling-shared-drive-syncing)

#### Granting Scopes <a href="#h-granting-scopes" id="h-granting-scopes"></a>

File Search needs two additional Google Drive scopes, `drive` and `drive.activity`, granted to Material through domain-wide delegation for each Google tenant you want to sync. For steps, see [Google Drive Security Settings](https://docs.material.security/getting-started/deployment-guides/your-first-30-days/1-connect-and-sync.md#google-drive-security-settings).

If you have questions about granting scopes, contact Material Support.

#### Enabling My Drive Syncing <a href="#h-enabling-my-drive-syncing" id="h-enabling-my-drive-syncing"></a>

Enabling My Drive Syncing allows Material to sync and analyze files stored in My Drives. You turn it on in **Google Drive Security** > **Settings**, where you also choose which accounts and groups to sync. For steps, see [Google Drive Security Settings](https://docs.material.security/getting-started/deployment-guides/your-first-30-days/1-connect-and-sync.md#google-drive-security-settings).

#### Enabling Shared Drive Syncing <a href="#h-enabling-shared-drive-syncing" id="h-enabling-shared-drive-syncing"></a>

Enabling Shared Drive Syncing allows Material to sync and analyze files stored in Shared Drives. Because there is no single “owner” of a Shared Drive, Shared Drive Syncing is not tied to a particular Account or Group. Instead, you choose which Shared Drives to sync. For steps, see [Google Drive Security Settings](https://docs.material.security/getting-started/deployment-guides/your-first-30-days/1-connect-and-sync.md#google-drive-security-settings).

If you exclude a Shared Drive later, Material ignores any new activity from it.

{% hint style="info" %}
Material doesn't delete activity or analysis it already processed for a Shared Drive you exclude later. Data that's already synced stays visible and searchable in File Search.
{% endhint %}

### File Search <a href="#h-file-search" id="h-file-search"></a>

Once Google Drive data is syncing, you can use File Search to write custom queries about your Google Drive environment. Material offers several *Suggested Queries* to help get you started. Click a *Suggested Query* to fill in the search bar and run the search.

#### Search modes

File Search has three modes, which you choose with **Search Mode** at the top of the search:

* **Quick**: a form where you search by file name, owner, type, location, sharing, and sensitive-data category, without writing a query.
* **Prompt**: describe what you're looking for in plain English, without writing a query.
* **Query**: the full search syntax described below.

<figure><img src="https://3411262179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FksjM8NywYRSHu1IlfxdP%2Fuploads%2FBwR6MdtNfhey9oPYjaSz%2Fimage.png?alt=media&#x26;token=40b08970-7691-41cd-b11e-13492d92d868" alt="File Search Search Mode selector with Quick, Prompt, and Query modes"><figcaption><p>Explorer > Files</p></figcaption></figure>

{% hint style="info" %}
**Prompt** mode isn't available if you've opted out of Material's GenAI capabilities.
{% endhint %}

Every mode supports **Save as detection**, so you can turn a search you've built into a detection without rewriting it. In **Prompt** mode that means you can describe the files you want to find in plain language and save that search as a detection directly.

In **Quick** mode, the **Trusted external** filter matches files shared externally to a trusted entity, separately from files shared externally in general. In **Query** mode, use the `shared.with_trusted_entity` operator.

<figure><img src="https://3411262179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FksjM8NywYRSHu1IlfxdP%2Fuploads%2FFXorR9kO0jrt6QdJtAxY%2Fimage.png?alt=media&#x26;token=8a1b675c-4092-44cd-9231-43115f089aa2" alt="Explorer Files search showing the Trusted external filter"><figcaption><p>Explorer > Files</p></figcaption></figure>

#### Search Syntax <a href="#h-search-syntax" id="h-search-syntax"></a>

As you write a query, File Search suggests syntax, shows documentation for each option, filters suggestions as you type, and checks that your query is valid.

File Search offers four core *namespaces* to help organize your query building blocks. Each namespace has a set of corresponding *properties*:

| Namespace | Description                                                    | Examples                                              |
| --------- | -------------------------------------------------------------- | ----------------------------------------------------- |
| File      | Search across file metadata and content.                       | id, name, type, content, and owner                    |
| Category  | Search for files containing specific sensitive data categories | ssn, credit\_card, ein, passport                      |
| Shared    | Search for files that have been shared in specific ways        | externally, with\_personal\_email, with\_public\_link |
| Location  | Search for files stored in a specific location                 | my\_drive, shared\_drive                              |

When writing a query, all supported namespaces, properties, and operators are suggested to you. In addition, File Search supports `and`, `or`, `not` operators, as well as parentheses `(`, `)`.

#### Validation <a href="#h-validation" id="h-validation"></a>

As you build your query, the Search button is enabled only when the query syntax is valid.

#### Keyboard Shortcuts <a href="#h-keyboard-shortcuts" id="h-keyboard-shortcuts"></a>

You can use your keyboard to quickly build queries. When the suggestion menu is open, use the `DOWN` / `UP` arrow keys to cycle through available options. Use `ENTER` or `TAB` to add the selected value to your query.

Use `ESCAPE` to close the suggestion menu at any time, and `DOWN` to reopen it.

Whenever the Search button is enabled, use `ENTER` to run the current search query.

#### Example Queries <a href="#h-example-queries" id="h-example-queries"></a>

Here are a few example queries to help you understand how the search syntax works:

**Example: Searching for Sensitive Financial Data, Shared Externally**

`shared.externally and (category.bank_routing or category.ein or category.financial_report)`

**Example: Searching for All Sensitive Files an Account Has Access To**

`shared.has_access:"tom@example.com" and category.any`

**Example: Searching in Shared Drives for Files Containing SSNs that are Shared with Personal Email**

`location.is_shared_drive and category.ssn and shared.with_personal_email`

For a full list of available search operators, see the *File Search Operator Reference* below:

#### File Search Operator Reference <a href="#h-file-search-operator-reference" id="h-file-search-operator-reference"></a>

<table><thead><tr><th width="250">Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td>object</td><td>Search for files based on the kind of sensitive data they contain</td></tr><tr><td><strong>category.any</strong></td><td>bool</td><td>Files containing any category of sensitive data</td></tr><tr><td><strong>category.bank_routing</strong></td><td>bool</td><td>Files containing: US bank routing numbers</td></tr><tr><td><strong>category.confidential</strong></td><td>bool</td><td>Files containing: Information marked as privileged or confidential</td></tr><tr><td><strong>category.credit_card</strong></td><td>bool</td><td>Files containing: Credit card numbers</td></tr><tr><td><strong>category.drivers_license</strong></td><td>bool</td><td>Files containing: Drivers license numbers</td></tr><tr><td><strong>category.ein</strong></td><td>bool</td><td>Files containing: US employer identification numbers</td></tr><tr><td><strong>category.financial_report</strong></td><td>bool</td><td>Files containing: Financial reports such as income statements, balance sheets or projections</td></tr><tr><td><strong>category.health_record</strong></td><td>bool</td><td>Files containing: Health records including lab test results and biometric data</td></tr><tr><td><strong>category.iban</strong></td><td>bool</td><td>Files containing: International Bank Account Number (IBAN) codes</td></tr><tr><td><strong>category.passport</strong></td><td>bool</td><td>Files containing: Passport numbers</td></tr><tr><td><strong>category.password</strong></td><td>bool</td><td>Files containing: Passwords</td></tr><tr><td><strong>category.patent</strong></td><td>bool</td><td>Files containing: Patent documents such as applications and inventor declarations</td></tr><tr><td><strong>category.payroll</strong></td><td>bool</td><td>Files containing: Wages and payroll statements</td></tr><tr><td><strong>category.source_code</strong></td><td>bool</td><td>Files containing: Source code</td></tr><tr><td><strong>category.ssn</strong></td><td>bool</td><td>Files containing: US Social Security numbers</td></tr><tr><td><strong>category.swift</strong></td><td>bool</td><td>Files containing: SWIFT codes</td></tr><tr><td><strong>category.tax_document</strong></td><td>bool</td><td>Files containing: Completed common US Tax Forms such as Form W-2, Form W-9, etc.</td></tr><tr><td><strong>file</strong></td><td>object</td><td>Search for files based on content, owner, and other metadata</td></tr><tr><td><strong>file.content</strong></td><td>string</td><td>Search for files by content</td></tr><tr><td><strong>file.created</strong></td><td>date</td><td>Search for files by created date</td></tr><tr><td><strong>file.id</strong></td><td>string</td><td>Search for files by id</td></tr><tr><td><strong>file.labels</strong></td><td>array</td><td>Search for files with a label</td></tr><tr><td><strong>file.last_modified</strong></td><td>date</td><td>Search for files by last modified date</td></tr><tr><td><strong>file.name</strong></td><td>string</td><td>Search for files by name</td></tr><tr><td><strong>file.owner</strong></td><td>string</td><td>Search for files by owner</td></tr><tr><td><strong>file.type</strong></td><td>object</td><td>Search for files by type</td></tr><tr><td><strong>file.type.document</strong></td><td>bool</td><td>Matches documents, such as Google Document or Word Document</td></tr><tr><td><strong>file.type.drawing</strong></td><td>bool</td><td>Matches drawings, such as Google Drawing</td></tr><tr><td><strong>file.type.image</strong></td><td>bool</td><td>Matches images, such as .jpg, .png, .svg, and .webp</td></tr><tr><td><strong>file.type.mime_type</strong></td><td>string</td><td>Search for files matching a mime type string</td></tr><tr><td><strong>file.type.pdf</strong></td><td>bool</td><td>Matches PDFs</td></tr><tr><td><strong>file.type.presentation</strong></td><td>bool</td><td>Matches presentations, such as Google Presentation or PowerPoint</td></tr><tr><td><strong>file.type.spreadsheet</strong></td><td>bool</td><td>Matches spreadsheets, such as Google Sheet or Excel</td></tr><tr><td><strong>file.type.text</strong></td><td>bool</td><td>Matches text files, such as .txt and .rtf</td></tr><tr><td><strong>location</strong></td><td>object</td><td>Search for files based on where they're stored</td></tr><tr><td><strong>location.is_my_drive</strong></td><td>bool</td><td>Search for files that are stored in a user's My Drive</td></tr><tr><td><strong>location.is_shared_drive</strong></td><td>bool</td><td>Search for files that are stored in shared drives</td></tr><tr><td><strong>location.shared_drive</strong></td><td>object</td><td>Search for files that are stored in a specific shared drive</td></tr><tr><td><strong>location.shared_drive.id</strong></td><td>string</td><td>Search for shared drives by id</td></tr><tr><td><strong>shared</strong></td><td>object</td><td>Search for files based on how they've been shared</td></tr><tr><td><strong>shared.externally</strong></td><td>bool</td><td>Search for files that are shared outside the organization in any way (by link or with explicit entities)</td></tr><tr><td><strong>shared.with_trusted_entity</strong></td><td>bool</td><td>Search for files that are shared externally to a trusted entity</td></tr><tr><td><strong>shared.has_access</strong></td><td>string</td><td>Search for files that this email has access to</td></tr><tr><td><strong>shared.restricted</strong></td><td>bool</td><td>Search for files where the general access is restricted to those entities with which the file is explicitly shared</td></tr><tr><td><strong>shared.with</strong></td><td>object</td><td>Search for files that are shared with...</td></tr><tr><td><strong>shared.with.domain</strong></td><td>string</td><td>Search for files that are shared with this entire Google Workspace domain</td></tr><tr><td><strong>shared.with.email</strong></td><td>string</td><td>Search for files that are shared with this email</td></tr><tr><td><strong>shared.with.group</strong></td><td>string</td><td>Search for files that are shared with this group</td></tr><tr><td><strong>shared.with_disposable_email</strong></td><td>bool</td><td>Search for files that are shared with an email address known to be provided by a disposable email service such as Temp-Mail or 10MinuteMail</td></tr><tr><td><strong>shared.with_employee_personal_email</strong></td><td>bool</td><td>Search for files that are shared with a personal email address whose display name or username contains the first or last name of an internal user who has explicit access to the file. Note this does not detect access to the file via group or organization membership.</td></tr><tr><td><strong>shared.with_org</strong></td><td>bool</td><td>Search for files that are shared with the organization</td></tr><tr><td><strong>shared.with_personal_email</strong></td><td>bool</td><td>Search for files that are shared with an email address with a domain typically used for personal email accounts, such as gmail.com or yahoo.com</td></tr><tr><td><strong>shared.with_public_link</strong></td><td>bool</td><td>Search for files that are publicly accessible to anyone with a link</td></tr><tr><td><strong>shared.allow_file_discovery</strong></td><td>bool</td><td>Search for files that people can find by searching in Google Drive, rather than only through a direct link</td></tr><tr><td><strong>shared.with_sanctioned_country_tld</strong></td><td>bool</td><td>Search for files shared with top-level domains associated with a country with comprehensive US sanctions (<a href="#top-level-domain-tld-list-for-shared.with_sanctioned_country_tld">complete list here</a>)</td></tr></tbody></table>

### FAQ <a href="#h-faq" id="h-faq"></a>

**What file types are supported?**

File Search supports the most common cloud office documents, including native Google file types (Google Docs, Google Sheets, and Google Slides), Microsoft Office documents, and common file types like PDF, CSV, and various images. Material doesn't process video files or large binary files.

**Are there file size limitations?**

File Search looks across your entire Google Drive footprint to help provide visibility. Material processes files up to 10 MB for sensitive content, and syncs metadata so all other files are searchable.

**How often does Material scan for new sensitive content or sharing?**

Material scans for changes in sensitive content and sharing based on document activity, not on a fixed refresh interval. When a change happens in Google Drive, Material processes that event and rescans for sensitive content when needed.

**How far back does Material scan historically?**

Material has access to 6 months of activity data for Google Drive, as limited by Google's APIs. Material also syncs all new activity for as long as syncing is enabled. This historical sync is based on *activity*, not file age. If a file created 10 years ago was modified in the last 6 months, Material scans it, and any older file that's touched later is scanned too. Over time, this covers most of your Google Drive footprint.

**What types of sensitive data does Material scan for?**

Material scans for 16 built-in Sensitive Content Categories. For the full list, see the suggestion menu in File Search, under the `category` namespace.

**Can I save queries as part of File Search?**

File Search doesn't save queries. To reuse a search, save it as a detection instead.

**Why can’t I see a file preview?**

Material previews file types that support text extraction, so images don't have previews. Files like PDFs show a plain text preview.

**Are Google Workspace domains and DNS domains the same thing?**

They are related but not entirely the same. `shared.with.domain` refers to the concept of a Google Workspace domain that is [configured as a trusted domain](https://knowledge.workspace.google.com/admin/domains/allow-external-sharing-with-only-trusted-domains) in your Google Drive sharing settings. To search for a file shared with any email address ending with a particular DNS domain such as `example.com`, use the contains operator, such as `shared.with.email:~"@example.com"`.

***

## Appendix

### **Top Level Domain (TLD) List** for `shared.with_sanctioned_country_tld`

{% hint style="info" %}
Material matches sharing with sanctioned countries by the top-level domain (TLD) of the email address or domain a file is shared with, not by the recipient's IP address or physical location. For example, a file shared with an address ending in `.ru` matches the Russia entry in this list, wherever the recipient is.
{% endhint %}

| Cuba        | .cu |
| ----------- | --- |
| Iran        | .ir |
| North Korea | .kp |
| Russia      | .ru |


---

# 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.material.security/working-with-issues/explorer/file-search.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.
