Create datasets in Postman

Beta
View as Markdown

Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the pricing page.

Use datasets to 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 data files and live data from external systems, so you can test different scenarios without duplicating or managing data in multiple places.

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 CSV or JSON data files (locally or in the Postman cloud) 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 data files (static) or live data (dynamic), such as a MySQL database.

To create a dataset, do the following:

  1. In the left sidebar, click Add icon and select Dataset.
  2. (Optional) Enter a name and description for your dataset.
  3. Click the data source dropdown list, then select a data source type. You can’t update the data source type after you create a data source.
  4. Configure the data source.
  5. (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.
  6. 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.

Create a dataset with Agent Mode

You can use Agent Mode to quickly generate a dataset with sample data. Agent Mode can create CSV or JSON data files (locally or in the Postman cloud) with realistic data, so you can get started without manually creating test data.

For example, you could ask Agent Mode the following:

Create a dataset with sample data
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 to customize how you retrieve the data, such as filtering users by name or selecting specific fields.

About the dataset file

In the Postman desktop app in Local View, 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. The following data source types are available: data file (locally or in the Postman cloud), MySQL database, and PostgreSQL database.

Local file

You can select a CSV or JSON file from your local machine.

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.

In Local View, the Copy file to workspace checkbox is selected by default. 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 beneficial to copy local files to your workspace so Agent Mode can modify them with sample data.

In Cloud View, you can create a Postman cloud file, which is a CSV file stored in the Postman cloud.

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. Click Unlock icon next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click Vault icon 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. Click Unlock icon next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click Vault icon next to a field and select a different vault secret.

Postman cloud file

In Cloud View, you can select a CSV file from your local machine. Postman cloud files are stored in the Postman cloud, so you can access them across different devices and share them with your team.

  1. Select Postman Cloud File from the data source dropdown list.
  2. Select a CSV file.