Search query terms and operators Stay organized with collections Save and categorize content based on your preferences.
This reference guide provides query terms and operators you can use with theGoogle Drive API to filter for files, folders, and shared drives.
For file search examples, seeSearch for files andfolders.
For example searches of shared drives, seeSearch for shared drives.
Query string syntax
A query string contains the following three parts:
query_term operator values
Where:
query_termis the query term or field to search upon.operatorspecifies the condition for the query term.valuesare the specific values you want to use to filter your searchresults.
Query operators
The following table lists the valid query operators:
| Operator | Usage |
|---|---|
contains | The content of one string is present in the other. |
= | The content of a string or boolean is equal to the other. |
!= | The content of a string or boolean is not equal to the other. |
< | A value is less than another. |
<= | A value is less than or equal to another. |
> | A value is greater than another. |
>= | A value is greater than or equal to another. |
in | An element is contained within a collection. |
and | Return items that match both queries. |
or | Return items that match either query. |
not | Negates a search query. |
has | A collection contains an element matching the parameters. |
File-specific query terms
The following table lists all valid file query terms. For data types anddescriptions, refer to thefiles resourcereference.
files.name replacesfiles.title. If you're usingDrive API v2, adjust these queries to use thev2 fields. For more information, seeDrive API v2 and v3 comparisonreference.| Query term | Valid operators | Usage |
|---|---|---|
name | contains,=,!= | Name of the file. Surround with single quotes ('). Escape single quotes in queries with\', such as'Valentine\'s Day'. |
fullText | contains | Whether thename,description,indexableText properties, or text in the file's content or metadata of the file matches. Surround with single quotes ('). Escape single quotes in queries with\', such as'Valentine\'s Day'. |
mimeType | contains,=,!= | MIME type of the file. Surround with single quotes ('). Escape single quotes in queries with\', such as'Valentine\'s Day'. For further information on MIME types, seeGoogle Workspace and Google Drive supported MIME types. |
modifiedTime | <=,<,=,!=,>,>= | Date of the last file modification.RFC 3339 format, default time zone is UTC, such as2012-06-04T12:00:00-08:00. Fields of typedate are not comparable to each other, only to constant dates. |
viewedByMeTime | <=,<,=,!=,>,>= | Date that the user last viewed a file.RFC 3339 format, default time zone is UTC, such as2012-06-04T12:00:00-08:00. Fields of typedate are not comparable to each other, only to constant dates. |
trashed | =,!= | Whether the file is in the trash or not. Can be eithertrue orfalse. |
starred | =,!= | Whether the file is starred or not. Can be eithertrue orfalse. |
parents | in | Whether the parents collection contains the specified ID. |
owners | in | Users who own the file. |
writers | in | Users or groups who have permission to modify the file. See thepermissions resource reference. |
readers | in | Users or groups who have permission to read the file. See thepermissions resource reference. |
sharedWithMe | =,!= | Files that are in the user's"Shared with me" collection. All file users are in the file's Access Control List (ACL). Can be eithertrue orfalse. |
createdTime | <=,<,=,!=,>,>= | Date when the file was created. UseRFC 3339 format, default time zone is UTC, such as2012-06-04T12:00:00-08:00. |
properties | has | Public custom file properties. |
appProperties | has | Private custom file properties. |
visibility | =,!= | The visibility level of the file. Valid values areanyoneCanFind,anyoneWithLink,domainCanFind,domainWithLink, andlimited. Surround with single quotes ('). |
shortcutDetails.targetId | =,!= | The ID of the item the shortcut points to. |
The following demonstrates operator and query term combinations:
The
containsoperator only performs prefix matching for anameterm. For example, suppose you have a nameofHelloWorld. A query ofname contains 'Hello'returns aresult, but a query ofname contains 'World'doesn't.The
containsoperator only performs matching on entire string tokens forthefullTextterm. For example, if the full text of a document containsthe string "HelloWorld", only the queryfullText contains 'HelloWorld'returns a result.The
containsoperator matches a phrase if the right operand is surroundedby double quotes. For example:If the
fullTextof a document contains the string "Hello there world",then the queryfullText contains '"Hello there"'returns a result, but thequeryfullText contains '"Hello world"'doesn't.If the full text of a document contains the string "Hello_world", thenthe query
fullText contains '"Hello world"'still returns a result asthe underscore in the document string is treated as a space.
The
owners,writers, andreadersterms are indirectly reflected in thepermissionslist and refer to theroleon the permission. For a complete list of role permissions, seeRoles andpermissions.
For more examples of query string searches, seefile query string examples.
Shared drive-specific query terms
The following table lists all valid shared drive query terms. For data types anddescriptions, see thedrives resource reference.
| Query term | Valid operators | Usage | useDomainAdminAccess setting |
|---|---|---|---|
createdTime | <=,<,=,!=,>,>= | Date when the shared drive was created.RFC 3339 format, default time zone is UTC, such as2012-06-04T12:00:00-08:00. | true |
hidden | =,!= | Specifies whether the shared drive is hidden. Can be eithertrue orfalse. | false |
memberCount | <=,<,=,!=,>,>= | Number of users and groups that are members of the shared drive. Takes a numerical value. | true |
name | contains,=,!= | Name of the shared drive. Surround with single quotes ('). Escape single quotes in queries with\', such as'Valentine\'s Day'. | true |
organizerCount | <=,<,=,!=,>,>= | Number of users and groups that are organizers of the shared drive. Takes a numerical value. | true |
orgUnitId | =,!= | The organizational unit ID of a shared drive. Takes a string value. | true |
useDomainAdminAccess setting, see thedrives.list method.For more examples of query string searches, seeshared drive query stringexamples.
Related topics
- Search for files and folders
- Search for shared drives
- Google Workspace and Google Drive supported MIME types
- Roles and permissions
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-05 UTC.