Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/sensitive-data-protection/docs/redacting-sensitive-data-images to learn more.
When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.
Only the first frame of each multiframe image is redacted. Metadata and other frames are omitted in the response.
HTTP request
POST https://dlp.googleapis.com/v2/{parent=projects/*}/image:redact
The URLs use gRPC Transcoding syntax.
Path parameters
parent
string
Parent resource name.
The format of this value varies depending on whether you have specified a processing location :
- Projects scope, location specified:
projects/{projectId}/locations/{locationId} - Projects scope, no location specified (defaults to global):
projects/{projectId}
The following example parent
string specifies a parent project with the identifier example-project
, and specifies the europe-west3
location for processing data:
parent=projects/example-project/locations/europe-west3
Authorization requires the following IAM
permission on the specified resource parent
:
-
serviceusage.services.use
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "locationId" : string , "inspectConfig" : { object ( |
locationId
string
Deprecated. This field has no effect.
inspectConfig
object (
InspectConfig
)
Configuration for the inspector.
imageRedactionConfigs[]
object (
ImageRedactionConfig
)
The configuration for specifying what content to redact from images.
includeFindings
boolean
Whether the response should include findings along with the redacted image.
byteItem
object (
ByteContentItem
)
The content must be PNG, JPEG, SVG or BMP.
inspectTemplate
string
The full resource name of the inspection template to use. Settings in the main inspectConfig
field override the corresponding settings in this inspection template.
The merge behavior is as follows:
- Singular field: The main field's value replaces the value of the corresponding field in the template.
- Repeated fields: The field values are appended to the list defined in the template.
- Sub-messages and groups: The fields are recursively merged.
deidentifyTemplate
string
The full resource name of the de-identification template to use. Settings in the main imageRedactionConfigs
field override the corresponding settings in this de-identification template. The request fails if the type of the template's deidentifyConfig is not imageTransformations.
Response body
If successful, the response body contains an instance of RedactImageResponse
.
Authorization scopes
Requires the following OAuth scope:
-
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview .

