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

# Data Inventory

> Discover, classify, and label your data with built-in and custom data labels and tags

> **Outcome:** Learn how data labels are assigned, locked, and automatically classified during discovery.

## Overview

Formal automatically discovers and catalogs databases, schemas, tables, and columns across your infrastructure. The data inventory gives you visibility into what data exists, where it lives, and how sensitive it is.

The inventory is populated by the [Data Discovery Satellite](https://docs.formal.ai/docs/guides/core-concepts/satellites.md#data-discovery-satellite), which scans your [resources](https://docs.formal.ai/docs/glossary/index.md#resource) on a schedule. During each scan, columns can be automatically classified with **data labels** that identify sensitive data types.

## List Available Labels

Formal has two places to see available data labels.

* **Label picker:** Open **Data Inventory** and select a column label. The picker shows every label available for manual assignment.
* **Labels:** Open **Data Inventory** and click **Labels** to list and manage [built-in](#built-in-labels) and custom labels.

You can also list labels with the [ListDataLabels API](https://docs.formal.ai/api-reference/corev1inventoryservice/list-data-labels.md).

## Discovery

The Data Discovery Satellite connects to your resources and catalogs their structure:

* **Databases** and **schemas**
* **Tables** and **views**
* **Columns** with data types

Configure discovery schedules per resource with options for frequency (every 6, 12, 18, or 24 hours, or custom cron) and deletion policy for removed schemas.

See [Satellites](https://docs.formal.ai/docs/guides/core-concepts/satellites.md#data-discovery-satellite) for deployment and configuration.

## Data Labels

Data labels identify the type of sensitive data in a column or field (e.g., `email_address`, `social_security_number`, `phone_number`). Use labels in [policies](https://docs.formal.ai/docs/glossary/index.md#policy) to enforce masking, filtering, and access control based on data sensitivity.

Formal ships with built-in labels and supports custom labels with automatic matchers. During discovery, the Data Discovery Satellite applies those matchers to assign labels without manual work.

### Built-in Labels

Formal provides these labels as **Prompt** labels. Use the identifier in policies. Built-in labels appear in **Labels**, so you can edit or delete them like custom labels.

#### Personal and Contact Data

| Identifier | Default prompt |
| - | - |
| `name` | Person Name |
| `date_of_birth` | Date of Birth |
| `date_of_death` | Date of Death |
| `age` | Age |
| `email_address` | Email Address |
| `phone_number` | Phone Number |
| `fax_number` | Fax Number |

#### Location

| Identifier | Default prompt |
| - | - |
| `street_address` | Street Address |
| `city` | City |
| `county` | County |
| `precinct` | Precinct |
| `zip_code` | ZIP Code |
| `geocode` | Geocode |

#### Government Identifiers

| Identifier | Default prompt |
| - | - |
| `social_security_number` | Social Security Number |
| `driver_identification_number` | Driver Identification Number |
| `passport_number` | Passport Number |
| `individual_taxpayer_identification_number` | Individual Taxpayer Identification Number |
| `government_id_number` | Government ID Number |
| `personal_id_number` | Personal ID Number |

#### Healthcare

| Identifier | Default prompt |
| - | - |
| `medical_record_number` | Medical Record Number |
| `health_plan_beneficiary_id` | Health Plan Beneficiary ID |
| `subscriber_id` | Subscriber ID |
| `medical_claim_number` | Medical Claim Number |
| `medical_policy_number` | Medical Policy Number |
| `medical_license_number` | Medical License Number |
| `health_insurance_policy_number` | Health Insurance Policy Number |
| `health_insurance_provider` | Health Insurance Provider |
| `admission_date` | Admission Date |
| `discharge_date` | Discharge Date |

#### Financial

| Identifier | Default prompt |
| - | - |
| `account_number` | Account Number |
| `bank_account_number` | Bank Account Number |
| `bank_routing_number` | Bank Routing Number |
| `credit_card_number` | Credit/Debit Card Number |
| `credit_card_cvv` | Credit Card CVV |
| `international_bank_account_number` | International Bank Account Number |

#### Employment

| Identifier | Default prompt |
| - | - |
| `job_title` | Job Title |
| `department` | Department |
| `company_name` | Company Name |
| `employee_identification_number` | Employee Identification Number |
| `individual_compensation` | Individual Compensation |
| `professional_license_number` | Professional License Number |
| `certificate_license_number` | Certificate License Number |
| `certificate_number` | Certificate Number |

#### Vehicles and Devices

| Identifier | Default prompt |
| - | - |
| `license_plate_number` | License Plate Number |
| `vehicle_serial_number` | Vehicle Serial Number |
| `vehicle_model` | Vehicle Model |
| `device_identifier` | Device Identifier |
| `device_serial_number` | Device Serial Number |

#### Network

| Identifier | Default prompt |
| - | - |
| `url` | URL |
| `ip_address` | IP Address |
| `mac_address` | MAC Address |

#### Credentials and Attachments

| Identifier | Default prompt |
| - | - |
| `username` | Username |
| `password` | Password |
| `sensitive_attachment_name` | Sensitive Attachment Name |

### Custom Labels

Custom labels are labels your organization creates for its own data types. They appear in **Labels** and in the label picker.

### Inventory Path

Every object in the inventory has a **path** that identifies where it lives. Paths are dot-separated strings built from database hierarchy:

| Object type | Path format | Example |
| - | - | - |
| Database | `database` | `app` |
| Schema | `database.schema` | `app.public` |
| Table | `database.schema.table` | `app.public.customers` |
| Column | `database.schema.table.column` | `app.public.customers.email` |

The path does not include the [resource](https://docs.formal.ai/docs/glossary/index.md#resource) name. Formal stores the resource separately on each inventory object.

Regex label matchers run against the column path only. They do not inspect row values.

### When Labels Are Classified

Formal assigns labels in three ways:

**During scheduled discovery.** When the Data Discovery Satellite lists columns for a table, it runs automatic classifiers before writing results to the inventory. Discovery schedules are configured per resource (every 6, 12, 18, or 24 hours, or a custom cron).

**Manually in the Control Plane.** In **Data Inventory**, select a column and choose a label from the dropdown.

**Through the API or Terraform.** Use the inventory APIs or `formal_inventory_object_data_label_link` to set labels programmatically.

Automatic classification only runs during discovery scans. On each scan, discovery re-runs matchers and can assign or update labels on **unlocked** columns. **Locked** columns keep their current label.

Saving a matcher edit in **Labels** does not change any column labels by itself. The updated matcher takes effect on the next discovery scan—for unlocked columns only. Lock a column if you want to keep its label even after you change matchers.

### Label Locking

Locking is a per-column setting. It controls whether **scheduled discovery scans** can change that column's label.

Locking only matters once a column already has a label. It prevents discovery from **overwriting** that label on future scans. Unlabeled columns get labels on the next scan regardless of lock state.

| | Unlocked | Locked |
| - | - | - |
| Column already has a label | Discovery can update the label on the next scan if matchers produce a different result | Discovery keeps the current label; scans do not overwrite it |
| You change the label manually or via Terraform | Allowed | Allowed |

Lock a column when you have set the label yourself and do not want discovery to change it on future scans.

1. Open **Data Inventory** and select a column.
2. Turn on **Lock Label** in the Classification section.

Filter locked columns in the inventory toolbar with the **Locked** filter.

### Automatic Classification

Create custom labels from **Data Inventory** → **Labels**. Each label uses a **matcher** that tells discovery how to classify columns.

Discovery evaluates matchers in two stages:

1. **Regex matchers** run first against the column inventory path.
2. **Prompt matchers** run on columns that regex did not match.

#### Regex Labels

Regex labels match column paths with a regular expression. They do not read row values.

| Setting | Value |
| - | - |
| Matcher type | **Regex** |
| Pattern | A regular expression tested against `database.schema.table.column` |

Example: the pattern `(^|\.)email$` matches `app.public.customers.email` and `warehouse.staging.users.contact_email`.

Regex labels work with only the Data Discovery Satellite deployed. No LLM backend is required.

> [!NOTE]
>
> Patterns use [RE2 syntax](https://github.com/google/re2/wiki/Syntax) (supported regex features). Formal rejects unsupported patterns when you save the label.

#### Prompt Labels

Prompt labels use natural language to classify columns from metadata and sampled data.

| Setting | Value |
| - | - |
| Matcher type | **Prompt** |
| Prompt | A description of when the label applies, for example "Columns containing personal email addresses" |

For each unmatched column, discovery samples up to 10 row values from the table. The classifier receives the column name, data type, and those samples. It does not scan every row in the table.

Prompt labels require:

* A deployed [Data Discovery Satellite](https://docs.formal.ai/docs/guides/core-concepts/satellites.md#data-discovery-satellite)
* At least one prompt label in **Labels**
* AWS Bedrock as the LLM backend for classification (see below)
* A [native user](https://docs.formal.ai/docs/glossary/index.md#native-user) with `SELECT` permission on the tables being scanned. Discovery uses this credential to read sample rows.

Discovery calls Amazon Bedrock directly using the container's AWS credentials (for example, an ECS task role). Grant the role `bedrock:InvokeModel` access to the Claude Haiku inference profile in your account and region. See [Prompt Classification Backends](https://docs.formal.ai/docs/guides/core-concepts/satellites.md#prompt-classification-backends) for a full deployment example.

If sampling fails (for example, missing `SELECT` permission), regex labels still apply. Prompt labels are skipped for that table.

### Manual Label Management

Use **Labels** in the Control Plane to create, edit, and delete custom labels. You can also manage labels with the [ListDataLabels API](https://docs.formal.ai/api-reference/corev1inventoryservice/list-data-labels.md) or the Terraform `formal_data_label` resource.

### Use Labels in Policies

Reference labels in [policies](https://docs.formal.ai/docs/glossary/index.md#policy) to enforce data-sensitive access control. Labels are available via `col["data_label"]`.

```rego theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
package formal.v2

import rego.v1

default response := {"action": "allow"}

# Mask any column labeled as email_address
response := {"action": "mask_value"} if {
  col := input.row[_]
  col["data_label"] == "email_address"
}
```

```rego theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
package formal.v2

import rego.v1

default response := {"action": "allow"}

# Mask multiple sensitive label types
response := {"action": "mask_value"} if {
  col := input.row[_]
  col["data_label"] in ["email_address", "social_security_number", "phone_number"]
}
```

See [Policy Examples](https://docs.formal.ai/docs/guides/policies/examples.md) for more patterns.

## Tags

Tags are custom tags you define for organizing inventory objects. Unlike data labels, tags are not used for automatic classification.

Use tags to categorize data by team, environment, compliance scope, or any other dimension relevant to your organization. Tags are always custom.

Tags are also available in policy inputs. You can use them to write policies that target specific columns or files based on your own categories.

```rego theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
package formal.v2

import rego.v1

default response := {"action": "allow"}

response := {"action": "mask_value"} if {
  col := input.row[_]
  "finance" in col["tags"]
}
```

## Next Steps

> [card] [Deploy Satellites](https://docs.formal.ai/docs/guides/core-concepts/satellites.md)
>
> Set up AI and Data Discovery Satellites for automatic classification

> [card] [Write Policies](https://docs.formal.ai/docs/guides/policies/introduction.md)
>
> Use labels to enforce masking and access control

> [card] [Policy Examples](https://docs.formal.ai/docs/guides/policies/examples.md)
>
> See real-world policies using data labels

> [card] [Terraform Provider](https://docs.formal.ai/docs/guides/configuration/terraform.md)
>
> Manage labels and inventory as code


## Related topics

- [Protect Sensitive Data](https://docs.formal.ai/docs/guides/use-cases/protect-sensitive-data.md)
- [Formal Control Plane](https://docs.formal.ai/docs/guides/control-plane/overview.md)
- [Mask PII and Secrets](https://docs.formal.ai/docs/guides/policies/mask-pii.md)
- [Connector](https://docs.formal.ai/docs/changelog/connector.md)
- [MongoDB](https://docs.formal.ai/docs/guides/core-concepts/resources/mongodb.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.