---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/dataScans/{dataScansId}/jobs/{jobsId}:generateDataQualityRules"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/dataScans/{dataScansId}/jobs/{jobsId}:generateDataQualityRules"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/dataScans/{dataScansId}/jobs/{jobsId}:generateDataQualityRules

`POST /v1/projects/{projectsId}/locations/{locationsId}/dataScans/{dataScansId}/jobs/{jobsId}:generateDataQualityRules`

## Request

- Base URL: `https://dataplex.googleapis.com`
- URL: `https://dataplex.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/dataScans/{dataScansId}/jobs/{jobsId}:generateDataQualityRules`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/dataplex.read-write`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/dataplex.read-write`

Generates recommended data quality rules based on the results of a data profiling scan.Use the recommendations to build rules for a data quality scan.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `dataScansId` string, required
- `jobsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- GoogleCloudDataplexV1GenerateDataQualityRulesRequest: Request details for generating data quality rule recommendations.

## Response `200`

Successful response

- GoogleCloudDataplexV1GenerateDataQualityRulesResponse: Response details for data quality rule recommendations.
  - `rule` GoogleCloudDataplexV1DataQualityRule[]: The data quality rules that Dataplex Universal Catalog generates based on the results of a data profiling scan.
    - `attributes` object: Optional. Map of attribute name and value linked to the rule. The rules to evaluate can be filtered based on attributes provided here and a filter expression provided in the DataQualitySpec.filter field.
    - `column` string: Optional. The unnested column which this rule is evaluated against.
    - `debugQueries` GoogleCloudDataplexV1DataQualityRuleDebugQuery[]: Optional. Specifies the debug queries for this rule. Currently, only one query is supported, but this may be expanded in the future.
      - `description` string: Optional. Specifies the description of the debug query. The maximum length is 1,024 characters.
      - `sqlStatement` string: Required. Specifies the SQL statement to be executed.
    - `description` string: Optional. Description of the rule. The maximum length is 1,024 characters.
    - `dimension` string: Optional. The dimension a rule belongs to. Results are also aggregated at the dimension level. Custom dimension name is supported with all uppercase letters and maximum length of 30 characters.
    - `ignoreNull` boolean: Optional. Rows with null values will automatically fail a rule, unless ignore_null is true. In that case, such null rows are trivially considered passing.This field is only valid for the following type of rules: RangeExpectation RegexExpectation SetExpectation UniquenessExpectation
    - `name` string: Optional. A mutable name for the rule. The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-). The maximum length is 63 characters. Must start with a letter. Must end with a number or a letter.
    - `nonNullExpectation` GoogleCloudDataplexV1DataQualityRuleNonNullExpectation: Evaluates whether each column value is null.
    - `rangeExpectation` GoogleCloudDataplexV1DataQualityRuleRangeExpectation: Evaluates whether each column value lies between a specified range.
      - `maxValue` string: Optional. The maximum column value allowed for a row to pass this validation. At least one of min_value and max_value need to be provided.
      - `minValue` string: Optional. The minimum column value allowed for a row to pass this validation. At least one of min_value and max_value need to be provided.
      - `strictMaxEnabled` boolean: Optional. Whether each value needs to be strictly lesser than ('<') the maximum, or if equality is allowed.Only relevant if a max_value has been defined. Default = false.
      - `strictMinEnabled` boolean: Optional. Whether each value needs to be strictly greater than ('>') the minimum, or if equality is allowed.Only relevant if a min_value has been defined. Default = false.
    - `regexExpectation` GoogleCloudDataplexV1DataQualityRuleRegexExpectation: Evaluates whether each column value matches a specified regex.
      - `regex` string: Optional. A regular expression the column value is expected to match.
    - `rowConditionExpectation` GoogleCloudDataplexV1DataQualityRuleRowConditionExpectation: Evaluates whether each row passes the specified condition.The SQL expression needs to use GoogleSQL syntax (https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax) and should produce a boolean value per row as the result.Example: col1 >= 0 AND col2 < 10
      - `sqlExpression` string: Optional. The SQL expression.
    - `ruleSource` GoogleCloudDataplexV1DataQualityRuleRuleSource: Represents the rule source information from Catalog.
      - `rulePathElements` GoogleCloudDataplexV1DataQualityRuleRuleSourceRulePathElement[]: Output only. Rule path elements represent information about the individual items in the relationship path between the scan resource and rule origin in that order.
        - `entryLinkSource` GoogleCloudDataplexV1DataQualityRuleRuleSourceRulePathElementEntryLinkSource: Entry link source represents information about the entry link.
          - `entryLink` string: Output only. The entry link name in the form of: projects/{project_id_or_number}/locations/{location_id}/entryGroups/{entry_group_id}/entryLinks/{entry_link_id}
          - `entryLinkType` string: Output only. The entry link type to represent the current relationship between the entry and the next entry in the path. In the form of: projects/{project_id_or_number}/locations/{location_id}/entryLinkTypes/{entry_link_type_id}
        - `entrySource` GoogleCloudDataplexV1DataQualityRuleRuleSourceRulePathElementEntrySource: Entry source represents information about the related source entry.
          - `displayName` string: Output only. The display name of the entry.
          - `entry` string: Output only. The entry name in the form of: projects/{project_id_or_number}/locations/{location_id}/entryGroups/{entry_group_id}/entries/{entry_id}
          - `entryType` string: Output only. The entry type to represent the current characteristics of the entry in the form of: projects/{project_id_or_number}/locations/{location_id}/entryTypes/{entry-type-id}.
    - `setExpectation` GoogleCloudDataplexV1DataQualityRuleSetExpectation: Evaluates whether each column value is contained by a specified set.
      - `values` string[]: Optional. Expected values for the column value.
    - `sqlAssertion` GoogleCloudDataplexV1DataQualityRuleSqlAssertion: A SQL statement that is evaluated to return rows that match an invalid state. If any rows are are returned, this rule fails.The SQL statement must use GoogleSQL syntax (https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax), and must not contain any semicolons.You can use the data reference parameter ${data()} to reference the source table with all of its precondition filters applied. Examples of precondition filters include row filters, incremental data filters, and sampling. For more information, see Data reference parameter (https://cloud.google.com/dataplex/docs/auto-data-quality-overview#data-reference-parameter).Example: SELECT * FROM ${data()} WHERE price < 0
      - `sqlStatement` string: Optional. The SQL statement.
    - `statisticRangeExpectation` GoogleCloudDataplexV1DataQualityRuleStatisticRangeExpectation: Evaluates whether the column aggregate statistic lies between a specified range.
      - `maxValue` string: Optional. The maximum column statistic value allowed for a row to pass this validation.At least one of min_value and max_value need to be provided.
      - `minValue` string: Optional. The minimum column statistic value allowed for a row to pass this validation.At least one of min_value and max_value need to be provided.
      - `statistic` 'STATISTIC_UNDEFINED' | 'MEAN' | 'MIN' | 'MAX': Optional. The aggregate metric to evaluate.
      - `strictMaxEnabled` boolean: Optional. Whether column statistic needs to be strictly lesser than ('<') the maximum, or if equality is allowed.Only relevant if a max_value has been defined. Default = false.
      - `strictMinEnabled` boolean: Optional. Whether column statistic needs to be strictly greater than ('>') the minimum, or if equality is allowed.Only relevant if a min_value has been defined. Default = false.
    - `suspended` boolean: Optional. Whether the Rule is active or suspended. Default is false.
    - `tableConditionExpectation` GoogleCloudDataplexV1DataQualityRuleTableConditionExpectation: Evaluates whether the provided expression is true.The SQL expression needs to use GoogleSQL syntax (https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax) and should produce a scalar boolean result.Example: MIN(col1) >= 0
      - `sqlExpression` string: Optional. The SQL expression.
    - `templateReference` GoogleCloudDataplexV1DataQualityRuleTemplateReference: A rule that constructs a SQL statement to evaluate using a rule template and parameter values. If the constructed statement returns any rows, this rule fails
      - `name` string: Required. The template entry name. Entry must be of EntryType projects/dataplex-types/locations/global/entryTypes/data-quality-rule-template and contains top-level aspect of AspectType projects/dataplex-types/locations/global/aspectTypes/data-quality-rule-template. The format is: projects/{project_id_or_number}/locations/{location_id}/entryGroups/{entry_group_id}/entries/{entry_id}
      - `resolvedSql` string: Output only. The resolved SQL statement generated from the template with parameters substituted. It is only populated in the result.
      - `ruleTemplate` GoogleCloudDataplexV1DataQualityRuleTemplate: DataQualityRuleTemplate represents a template which can be reused across multiple data quality rules.
        - `capabilities` string[]: Output only. A list of features or properties supported by this rule template.
        - `dimension` string: Output only. The dimension a rule template belongs to. Rule level results are also aggregated at the dimension level.
        - `inputParameters` object: Output only. Description for input parameters
        - `name` string: Output only. The name of the rule template in the format: projects/{project_id_or_number}/locations/{location_id}/entryGroups/{entry_group_id}/entries/{entry_id}
        - `sqlCollection` GoogleCloudDataplexV1DataQualityRuleTemplateSql[]: Output only. Collection of SQLs for data quality rules. Currently only one SQL is supported.
          - `query` string: Output only. Templatized SQL query for data quality rules.
      - `values` object: Optional. Provides the map of parameter name and value. The maximum size of the field is 120KB (encoded as UTF-8).
    - `threshold` number, double: Optional. The minimum ratio of passing_rows / total_rows required to pass this rule, with a range of 0.0, 1.0.0 indicates default value (i.e. 1.0).This field is only valid for row-level type rules.
    - `uniquenessExpectation` GoogleCloudDataplexV1DataQualityRuleUniquenessExpectation: Evaluates whether the column has duplicates.

## Changes

- **2026-12-05** `5d0894669d35`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/dataplex.read-write` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/dataplex.read-write` was removed from the endpoint's security scheme `Oauth2c`
- **2026-11-09** `a87e571d134a`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/dataplex.read-write` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/dataplex.read-write` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/dataplex/changes/v1/projects/:projectsId/locations/:locationsId/dataScans/:dataScansId/jobs/:jobsId:generateDataQualityRules/post.md)

---

[API](https://skmtc.dev/google/apis/dataplex.md) - [All operations](https://skmtc.dev/google/apis/dataplex/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/dataplex/revisions/5d0894669d35?raw)
