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 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, JSON, or spreadsheet data files (locally or in the Postman Cloud) or external connections like MySQL, Postgres, or SQL Server.
  • 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 code mocks. Views support SQLite-compatible SQL syntax and functions.

Create a dataset

Create a dataset to use across your collection runs, code mocks, and scripts. A dataset can include multiple data sources, from data files (static) or live data (dynamic), such as MySQL, Postgres, or SQL Server.

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. Select the data source type you’d like to add. You can’t update the data source type after you create a data source.
  4. Configure the data source.
  5. Click Add source to add it to your dataset. You can add multiple data sources to combine different types of data in your workflows.

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 code mocks. 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, Postgres, and SQL Server.

Data file

You can select a CSV, JSON, or spreadsheet file from your local machine to use as a data source. Only local data files are supported in the Postman web app.

  1. Select File.

  2. Select a file from your local machine. You can also drag and drop a file.

  3. Review the data in the file content. You can search the table to find specific values.

  4. By default, the file is saved to your repository or the Postman Cloud:

    • In Local View, the Copy file to repository checkbox is selected by default. This copies the file to your local Git repository so it’s included in your workspace, can be shared with others, and can be modified by Agent Mode with sample data. This option isn’t available for large files.
    • In Cloud View, the Save file to Postman cloud checkbox is selected by default. This stores the file in the Postman Cloud so you can access it across different devices and share it with your team.
  5. Click Save.

External data source

You can connect to MySQL, Postgres, or SQL Server as an external data source. If your data source is behind a firewall or not publicly accessible, you can connect through an SSH tunnel. When using an SSH tunnel, the data source must be accessible from the SSH server’s network.

  1. Select MySQL, Postgres, or SQL Server.

  2. Enter the following connection details:

    • Host — The hostname or IP address of the database server.
    • Port — The port number for the database server.
    • Database — The name of the database to connect to.
    • Username — The username to authenticate with the database.
    • Password — The password to authenticate with the database.
    • Table — The name of the table to connect to.
    • Schema — The name of the schema to connect to. Postgres and SQL Server only.
  3. (Optional) Select Connect through an SSH tunnel and enter the following:

    • SSH host — The hostname or IP address of the SSH server.
    • SSH port — The port number for the SSH server.
    • SSH username — The username to connect to the SSH server.
    • SSH private key — The private key to authenticate with the SSH server. Click Choose a file to select a file, or paste the key directly.
    • SSH host key — The host key of the SSH server. Click Choose a file to select a file, or paste the key directly.
    • (Optional) Select Skip SSH host key verification — Skips verification of the SSH server’s host key. This can expose the connection to man-in-the-middle attacks. Use only for non-production testing.
  4. 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 Link to vault secret next to a field that accepts sensitive data and select a vault secret to use. To update a vault secret, click Vault icon Unlink vault secret next to a field to remove the vault secret.