> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Create datasets in Postman

<Info class="plan">
  Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the [pricing page](https://www.postman.com/pricing/).
</Info>

With datasets, you can manage and use data across your API workflows in Postman. You can run data-driven collection tests, power dynamic mock server responses, and reuse the same data across scripts. Datasets also enable you to work with both local files and live data from external systems, so you can test different scenarios without duplicating or managing data in multiple places.

<Note>
  Datasets are only supported in Local View on the Postman desktop app.
</Note>

## About datasets

A *dataset* is a set of data you can use across your API workflows. Each dataset is stored in a YAML file and organized into data sources and views:

* *Data sources* define where the data comes from, including local files (CSV or JSON) or external connections like a MySQL database.
* *Views* are SQL queries that define how data is retrieved from data sources. They enable you to select, filter, and combine data so it works with your tests, scripts, and mock servers. Views support SQLite-compatible SQL syntax and functions.

## Create a dataset

Create a dataset to use across your collection runs, local mock servers, and scripts. A dataset can include multiple data sources, from local files (static) or live data (dynamic), such as a MySQL database.

To create a dataset, do the following:

1. In the left sidebar, click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon" width="20px" /> and select **Dataset**.
2. Click the data source dropdown list, then select a [data source type](#data-source-types). You can't update the data source type after you create a data source.
3. Configure the data source.
4. (Optional) Click **Add New Source** to add more data sources to the dataset. Add multiple data sources to combine different types of data in your workflows.
5. Click **Save**.

A view is automatically created for each data source that selects all of the data. You can manage your data sources and views as your workflows change. This enables you to support new scenarios, combine data from different sources, and control how data is used across tests, scripts, and mock servers. Learn more about [managing datasets](/docs/tests-and-scripts/datasets/manage-datasets).

### Create a dataset with Agent Mode

You can use [Agent Mode](/docs/agent-mode/overview) to quickly generate a dataset with sample data. Agent Mode can create local CSV or JSON files with realistic data, so you can get started without manually creating test data.

For example, you could ask Agent Mode the following:

```text wordWrap
Create a dataset with sample user data, including userId, name, and email fields. Generate about 10 rows.
```

After Agent Mode generates the dataset, you can [add more views](/docs/tests-and-scripts/datasets/manage-datasets#manage-views) to customize how you retrieve the data, such as filtering users by name or selecting specific fields.

### About the dataset file

When you create a dataset, Postman generates a YAML file that defines its data sources and views. The file also includes metadata about the dataset, such as its name and ID. This file is stored in your local Git repository and serves as the source of truth for your dataset configuration.

Any changes you make to the dataset in Postman are reflected in this file, and updates to the file are reflected in Postman. You can use it to review changes and manage your dataset in version control.

The dataset file is located at `/postman/datasets/<dataset-name>/<dataset-name>.dataset.yaml`.

## Data source types

You can [add multiple data sources to a dataset](#create-a-dataset). The following data source types are available: local file, remote URL, MySQL database, and PostgreSQL database.

### Local file

You can select a CSV or JSON file from your local machine or create a new file in Postman.

To select an existing file, do the following:

1. Select **Local File** from the data source dropdown list.
2. Select a CSV or JSON file.

By default, the **Copy file to workspace** checkbox is selected. This copies the file to your local Git repository, so it's included in your workspace and can be shared with others. This option isn't available for large files.

It's also beneficial to copy local files to your workspace so Agent Mode can modify them with sample data.

### Remote URL

You can connect to a CSV or JSON file hosted at a remote URL.

1. Select **Remote URL** from the data source dropdown list.
2. Enter the URL of a remote CSV or JSON file.

### MySQL database

1. Select **MySQL** from the data source dropdown list.

2. Enter the following for the MySQL database you want to connect to:

   * **Host** — The hostname or IP address of the MySQL database server.
   * **Port** — The port number for the MySQL database server.
   * **Database** — The name of the database you want to connect to.
   * **Username** — The username to connect to the MySQL database.
   * **Password** — The password to connect to the MySQL database.
   * **Table** — The name of the table you want to connect to.

3. Click **Test connection** to verify the connection details are correct and Postman can connect to it. If the connection fails, check that your connection details are correct and your network allows connections to the data source.

Store sensitive data, such as the host and password, as vault secrets in [Postman Vault](/docs/sending-requests/postman-vault/postman-vault-secrets). Click <img alt="Unlock icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-unlock-stroke.svg#icon" width="20px" /> next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click <img alt="Vault icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-vault-stroke.svg#icon" width="20px" /> next to a field and select a different vault secret.

### PostgreSQL database

1. Select **PostgreSQL** from the data source dropdown list.

2. Enter the following for the PostgreSQL database you want to connect to:

   * **Host** — The hostname or IP address of the PostgreSQL database server.
   * **Port** — The port number for the PostgreSQL database server.
   * **Database** — The name of the database you want to connect to.
   * **Username** — The username to connect to the PostgreSQL database.
   * **Password** — The password to connect to the PostgreSQL database.
   * **Table** — The name of the table you want to connect to.
   * **Schema** — The name of the schema you want to connect to.

3. Click **Test connection** to verify the connection details are correct and Postman can connect to it. If the connection fails, check that your connection details are correct and your network allows connections to the data source.

Store sensitive data, such as the host and password, as vault secrets in [Postman Vault](/docs/sending-requests/postman-vault/postman-vault-secrets). Click <img alt="Unlock icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-unlock-stroke.svg#icon" width="20px" /> next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click <img alt="Vault icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-vault-stroke.svg#icon" width="20px" /> next to a field and select a different vault secret.