Create datasets in Postman
Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the pricing page.
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.
Datasets are only supported in Local View on the Postman desktop app.
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:
- In the left sidebar, click
and select Dataset.
- 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.
- Configure the data source.
- (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.
- 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 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:
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
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. 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:
- Select Local File from the data source dropdown list.
- 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.
- Select Remote URL from the data source dropdown list.
- Enter the URL of a remote CSV or JSON file.
MySQL database
-
Select MySQL from the data source dropdown list.
-
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.
-
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 next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click
next to a field and select a different vault secret.
PostgreSQL database
-
Select PostgreSQL from the data source dropdown list.
-
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.
-
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 next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click
next to a field and select a different vault secret.