Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.fhir.conditionalDelete
Deletes FHIR resources that match a search query.
Implements the FHIR standard conditional delete interaction (DSTU2, STU3, R4, R5). If multiple resources match, all matching resources are deleted.
Search terms are provided as query parameters following the same pattern as the search method.
Not all FHIR resources that match the search query might be deleted because, by default, a maximum of 100 FHIR resources can be deleted. The number of FHIR resources that can be deleted depends on the page size of the returned resources, which you can control using the _count query parameter. Even when using _count, you can delete a maximum 1,000 FHIR resources per each call of conditionalDelete.
Note: Unless resource versioning is disabled by setting the disableResourceVersioning flag on the FHIR store, the deleted resources are moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method.
This method requires thehealthcare.fhirStores.searchResources and healthcare.fhirResources.delete permissions on the parent FHIR store.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[[["\u003cp\u003eThis function, \u003ccode\u003econditionalDelete\u003c/code\u003e, deletes FHIR resources that match a specified search query, adhering to FHIR standard conditional delete interactions.\u003c/p\u003e\n"],["\u003cp\u003eSearch parameters are provided as query parameters, similar to the \u003ccode\u003esearch\u003c/code\u003e method, and if multiple resources match the query, all are deleted.\u003c/p\u003e\n"],["\u003cp\u003eBy default, a maximum of 100 FHIR resources can be deleted per call, with the maximum increasing to 1,000 per call if \u003ccode\u003e_count\u003c/code\u003e is used, which also depends on the page size of returned resources.\u003c/p\u003e\n"],["\u003cp\u003eDeleted resources are stored in a history repository that can be retrieved with the \u003ccode\u003evread\u003c/code\u003e method, unless resource versioning is disabled or they are purged with the \u003ccode\u003epurge\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eUsing this method requires specific permissions on the FHIR store: \u003ccode\u003ehealthcare.fhirStores.searchResources\u003c/code\u003e and \u003ccode\u003ehealthcare.fhirResources.delete\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: fhir.conditionalDelete\n\n**Full name**: projects.locations.datasets.fhirStores.fhir.conditionalDelete\n\nDeletes FHIR resources that match a search query.\n\nImplements the FHIR standard conditional delete interaction ([DSTU2](https://hl7.org/fhir/DSTU2/http.html#2.1.0.12.1), [STU3](https://hl7.org/fhir/STU3/http.html#2.21.0.13.1), [R4](https://hl7.org/fhir/R4/http.html#3.1.0.7.1), [R5](https://hl7.org/fhir/R5/http.html#3.1.0.7.1)). If multiple resources match, all matching resources are deleted.\n\nSearch terms are provided as query parameters following the same pattern as the [search](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores.fhir/search#google.cloud.healthcare.v1beta1.fhir.rest.FhirService.SearchResources) method.\n\nNot all FHIR resources that match the search query might be deleted because, by default, a maximum of 100 FHIR resources can be deleted. The number of FHIR resources that can be deleted depends on the page size of the returned resources, which you can control using the `_count` query parameter. Even when using `_count`, you can delete a maximum 1,000 FHIR resources per each call of `conditionalDelete`.\n\nNote: Unless resource versioning is disabled by setting the [disableResourceVersioning](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.disable_resource_versioning) flag on the FHIR store, the deleted resources are moved to a history repository that can still be retrieved through [vread](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores.fhir/vread#google.cloud.healthcare.v1beta1.fhir.rest.FhirService.GetResourceVersion) and related methods, unless they are removed by the [purge](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores.fhir/Resource-purge#google.cloud.healthcare.v1beta1.fhir.rest.FhirService.DeleteResourceVersions) method.\n\nThis method requires the`healthcare.fhirStores.searchResources` and `healthcare.fhirResources.delete` permissions on the parent FHIR store.\n\nFor samples that show how to call `conditionalDelete`, see [Conditionally deleting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_deleting_a_fhir_resource).\n\n### HTTP request\n\n`DELETE https://healthcare.googleapis.com/v1beta1/{parent=projects/*/locations/*/datasets/*/fhirStores/*}/fhir/{type}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body is an empty JSON object.\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-healthcare`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]