> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nx1cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set a data quality rule

> Set a data quality rule to enforce quality checks in your data.

Setting a data quality rule ensures your data adheres to data quality characteristics such as accuracy and consistency.

## Prerequisites

* Access to the NexusOne portal
* Appropriate permission: `nx1_quality`

## Select a dataset and set a rule

<Tabs>
  <Tab title="Web portal" icon="browser">
    Perform these steps to select a dataset and set a rule.

    1. Log in to NexusOne.
    2. On the top navigation bar, hover your mouse over **Data Pipeline** and then select **Quality**.
    3. Select your preferred catalog:
       * **iceberg**: When using an Iceberg table
       * **LLM**: Not applicable yet
    4. Select a schema and table.
    5. Set a rule. When setting a rule, there are three options:
       * **Generate a rule from a description**: To use this, enter an instruction describing
         the rule, then click **Send**. Here are a few examples of instructions:

         * Verify that all values in the `email` column follow the valid email address
           format ([user@example.com](mailto:user@example.com)).
         * Check that all values in the `state` column use two-letter state abbreviations
           only, such as `GA`, `CA`, or `NY`.

         Click **Accept** or **Ignore** when NexusOne generates a rule.
       * **Use recommended suggestions**: This displays both recommended rules and any previously
         generated custom rules. Click **Accept** or **Ignore** when NexusOne generates a rule.
       * **Create a custom rule**: To use this enter the following details:
         * In the **Rule Name** field, enter a rule name.
         * In the **Success Condition** field, enter a success condition.
         * In the **SQL Query** field, enter a SQL query.
         * Optional: In the **Description** field, describe what the rule validates.
         * Click **Create Rule**.
  </Tab>

  <Tab title="CLI" icon="square-terminal">
    Use the following `nx1` command to:

    1. [Select a table and get suggestions for a rule](/cli-reference/nx1/dq#suggest).
    2. [Accept the rule](/cli-reference/nx1/dq#accept).

    For more advanced use cases such as running assertions on DataHub, you can:

    1. [Run a report by table](/cli-reference/nx1/dq#rules).
    2. [Report assertion runs to DataHub](/cli-reference/nx1/dq#run).
  </Tab>

  <Tab title="REST API" icon="code">
    Use the following API endpoints to:

    1. [Select a table and get suggestions for a rule](/api-reference/endpoints/data-quality/suggest).
    2. [Accept the rule](/api-reference/endpoints/data-quality/accept).

    For more advanced use cases such as running assertions on DataHub, you can:

    1. Run a report by [rule](/api-reference/endpoints/data-quality/run-report-by-rule) or
       [table](/api-reference/endpoints/data-quality/run-report-by-table).
    2. [Report assertion runs to DataHub](/api-reference/endpoints/data-quality/report-assertion-runs).
  </Tab>
</Tabs>

## Additional resources

* For general instructions about how to ingest a file in NexusOne, refer to [How to ingest a file](/documentation/data-pipeline/tasks/ingest/ingest-a-file).
* For more information about roles or permissions, refer to [Govern Overview](/documentation/govern/overview).
