- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents/purge#body.aspect_1)

Permanently deletes all selected `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents#Document`s in a branch.

This process is asynchronous. Depending on the number of `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents#Document`s to be deleted, this operation can take hours to complete. Before the delete operation completes, some `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents#Document`s might still be returned by `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.branches.documents/get#google.cloud.discoveryengine.v1alpha.DocumentService.GetDocument` or `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.branches.documents/list#google.cloud.discoveryengine.v1alpha.DocumentService.ListDocuments`.

To get a list of the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents#Document`s to be deleted, set `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.branches.documents/purge#body.request_body.FIELDS.force` to false.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1alpha/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents:purge`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent resource name, such as `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}/branches/{branch}`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "filter": string, "errorConfig": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/PurgeErrorConfig`) }, "force": boolean, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "gcsSource": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/GcsSource`) }, "inlineSource": { object (`InlineSource`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `filter` | `string` Required. Filter matching documents to purge. Only currently supported value is `*` (all items). |
| `errorConfig` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/PurgeErrorConfig`)`` The desired location of errors incurred during the purge. |
| `force` | `boolean` Actually performs the purge. If `force` is set to false, return the expected purge count without deleting any documents. |
| The desired input source for the purging documents based on document IDs. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `gcsSource` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/GcsSource`)`` Cloud Storage location for the input content. Supported `dataSchema`: \* `documentId`: One valid `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores.branches.documents#Document.FIELDS.id` per line. |
| `inlineSource` | ``object (`InlineSource`)`` Inline source for the input content for purge. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `discoveryengine.documents.purge`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).