---
title: "POST /v1/matters/{matterId}/savedQueries"
method: POST
path: "/v1/matters/{matterId}/savedQueries"
tags: ["matters"]
---

# POST /v1/matters/{matterId}/savedQueries

`POST /v1/matters/{matterId}/savedQueries`

Creates a saved query.

## Path parameters

- `matterId` string, required

## Request body

- SavedQuery — The definition of a saved query. To work with Vault resources, the account must have the [required Vault privileges](https://support.google.com/vault/answer/2799699) and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the **View All Matters** privilege.
  - `displayName` string — The name of the saved query.
  - `matterId` string — Output only. The matter ID of the matter the saved query is saved in. The server does not use this field during create and always uses matter ID in the URL.
  - `savedQueryId` string — A unique identifier for the saved query.
  - `query` Query — The query definition used for search and export.
    - `accountInfo` AccountInfo — The accounts to search
      - `emails` string[] — A set of accounts to search.
    - `timeZone` string — The time zone name. It should be an IANA TZ name, such as "America/Los_Angeles". For a list of time zone names, see [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For more information about how Vault uses time zones, see [the Vault help center](https://support.google.com/vault/answer/6092995#time).
    - `hangoutsChatInfo` HangoutsChatInfo — The Chat spaces to search
      - `roomId` string[] — A list of Chat spaces IDs, as provided by the [Chat API](https://developers.google.com/workspace/chat). There is a limit of exporting from 500 Chat spaces per request.
    - `geminiOptions` GeminiOptions — Additional options for Gemini search
    - `dataScope` 'DATA_SCOPE_UNSPECIFIED' | 'ALL_DATA' | 'HELD_DATA' | 'UNPROCESSED_DATA' — The data source to search.
    - `sharedDriveInfo` SharedDriveInfo — The shared drives to search
      - `sharedDriveIds` string[] — A list of shared drive IDs, as provided by the [Drive API](https://developers.google.com/drive).
    - `teamDriveInfo` TeamDriveInfo — Team Drives to search
      - `teamDriveIds` string[] — List of Team Drive IDs, as provided by the [Drive API](https://developers.google.com/drive).
    - `calendarOptions` CalendarOptions — Additional options for Calendar search
      - `versionDate` string, google-datetime — Search the current version of the Calendar event, but export the contents of the last version saved before 12:00 AM UTC on the specified date. Enter the date in UTC.
      - `responseStatuses` string[] — Matches only events for which the custodian gave one of these responses. If the set is empty or contains ATTENDEE_RESPONSE_UNSPECIFIED there will be no filtering on responses.
      - `locationQuery` string[] — Matches only those events whose location contains all of the words in the given set. If the string contains quoted phrases, this method only matches those events whose location contain the exact phrase. Entries in the set are considered in "and". Word splitting example: ["New Zealand"] vs ["New","Zealand"] "New Zealand": matched by both "New and better Zealand": only matched by the later
      - `peopleQuery` string[] — Matches only those events whose attendees contain all of the words in the given set. Entries in the set are considered in "and".
      - `minusWords` string[] — Matches only those events that do not contain any of the words in the given set in title, description, location, or attendees. Entries in the set are considered in "or".
    - `searchMethod` 'SEARCH_METHOD_UNSPECIFIED' | 'ACCOUNT' | 'ORG_UNIT' | 'TEAM_DRIVE' | 'ENTIRE_ORG' | 'ROOM' | 'SITES_URL' | 'SHARED_DRIVE' | 'DRIVE_DOCUMENT' — The search method to use.
    - `sitesUrlInfo` SitesUrlInfo — The published site URLs of new Google Sites to search
      - `urls` string[] — A list of published site URLs.
    - `corpus` 'CORPUS_TYPE_UNSPECIFIED' | 'DRIVE' | 'MAIL' | 'GROUPS' | 'HANGOUTS_CHAT' | 'VOICE' | 'CALENDAR' | 'GEMINI' — The Google Workspace service to search.
    - `mailOptions` MailOptions — Additional options for Gmail search
      - `clientSideEncryptedOption` 'CLIENT_SIDE_ENCRYPTED_OPTION_UNSPECIFIED' | 'CLIENT_SIDE_ENCRYPTED_OPTION_ANY' | 'CLIENT_SIDE_ENCRYPTED_OPTION_ENCRYPTED' | 'CLIENT_SIDE_ENCRYPTED_OPTION_UNENCRYPTED' — Specifies whether the results should include encrypted content, unencrypted content, or both. Defaults to including both.
      - `excludeDrafts` boolean — Set to **true** to exclude drafts.
    - `voiceOptions` VoiceOptions — Additional options for Voice search
      - `coveredData` string[] — Datatypes to search
    - `driveDocumentInfo` DriveDocumentInfo — The Drive documents to search.
      - `documentIds` DriveDocumentIds — Specify Drive documents by document ID.
        - `ids` string[] — Required. A list of Drive document IDs.
    - `startTime` string, google-datetime — The start time for the search query. Specify in GMT. The value is rounded to 12 AM on the specified date.
    - `method` 'SEARCH_METHOD_UNSPECIFIED' | 'ACCOUNT' | 'ORG_UNIT' | 'TEAM_DRIVE' | 'ENTIRE_ORG' | 'ROOM' | 'SITES_URL' | 'SHARED_DRIVE' | 'DRIVE_DOCUMENT' — The entity to search. This field replaces **searchMethod** to support shared drives. When **searchMethod** is **TEAM_DRIVE**, the response of this field is **SHARED_DRIVE**.
    - `hangoutsChatOptions` HangoutsChatOptions — Additional options for Google Chat search
      - `includeRooms` boolean — For searches by account or organizational unit, set to **true** to include rooms.
    - `orgUnitInfo` OrgUnitInfo — The organizational unit to search
      - `orgUnitId` string — The name of the organizational unit to search, as provided by the [Admin SDK Directory API](https://developers.google.com/admin-sdk/directory/).
    - `terms` string — Service-specific [search operators](https://support.google.com/vault/answer/2474474) to filter search results.
    - `driveOptions` DriveOptions — Additional options for Drive search.
      - `includeTeamDrives` boolean — Set to true to include Team Drive.
      - `versionDate` string, google-datetime — Search the current version of the Drive file, but export the contents of the last version saved before 12:00 AM UTC on the specified date. Enter the date in UTC.
      - `includeSharedDrives` boolean — Set to **true** to include shared drives.
      - `sharedDrivesOption` 'SHARED_DRIVES_OPTION_UNSPECIFIED' | 'NOT_INCLUDED' | 'INCLUDED_IF_ACCOUNT_IS_NOT_A_MEMBER' | 'INCLUDED' — Optional. Options to include or exclude documents in shared drives. We recommend using this field over include_shared_drives. This field overrides include_shared_drives and include_team_drives when set.
      - `clientSideEncryptedOption` 'CLIENT_SIDE_ENCRYPTED_OPTION_UNSPECIFIED' | 'CLIENT_SIDE_ENCRYPTED_OPTION_ANY' | 'CLIENT_SIDE_ENCRYPTED_OPTION_ENCRYPTED' | 'CLIENT_SIDE_ENCRYPTED_OPTION_UNENCRYPTED' — Set whether the results include only content encrypted with [Google Workspace Client-side encryption](https://support.google.com/a?p=cse_ov) content, only unencrypted content, or both. Defaults to both. Currently supported for Drive.
    - `endTime` string, google-datetime — The end time for the search query. Specify in GMT. The value is rounded to 12 AM on the specified date.
  - `createTime` string, google-datetime — Output only. The server-generated timestamp when the saved query was created.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/vault.md) · [All operations](https://skmtc.dev/google/apis/vault/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/vault/revisions/db6937065136/schema)
