Search query terms and operators

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_term is the query term or field to search upon.

  • operator specifies the condition for the query term.

  • values are the specific values you want to use to filter your searchresults.

Query operators

The following table lists the valid query operators:

OperatorUsage
containsThe 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.
inAn element is contained within a collection.
andReturn items that match both queries.
orReturn items that match either query.
notNegates a search query.
hasA 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.

Important: The following query terms use fields fromDrive API v3. Some resource fields changed between v2 and v3. Forexample,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 termValid operatorsUsage
namecontains,=,!=Name of the file. Surround with single quotes ('). Escape single quotes in queries with\', such as'Valentine\'s Day'.
fullTextcontainsWhether 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'.
mimeTypecontains,=,!=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.
parentsinWhether the parents collection contains the specified ID.
ownersinUsers who own the file.
writersinUsers or groups who have permission to modify the file. See thepermissions resource reference.
readersinUsers 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.
propertieshasPublic custom file properties.
appPropertieshasPrivate 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:

  • Thecontains operator only performs prefix matching for aname term. For example, suppose you have a nameofHelloWorld. A query ofname contains 'Hello' returns aresult, but a query ofname contains 'World' doesn't.

  • Thecontains operator only performs matching on entire string tokens forthefullText term. For example, if the full text of a document containsthe string "HelloWorld", only the queryfullText contains 'HelloWorld'returns a result.

  • Thecontains operator matches a phrase if the right operand is surroundedby double quotes. For example:

    • If thefullText of 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 queryfullText contains '"Hello world"' still returns a result asthe underscore in the document string is treated as a space.

  • Theowners,writers, andreaders terms are indirectly reflected in thepermissions list 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 termValid operatorsUsageuseDomainAdminAccess 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
namecontains,=,!=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
Note: For more information on theuseDomainAdminAccess setting, see thedrives.list method.

For more examples of query string searches, seeshared drive query stringexamples.

Related topics

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.