Use a data file with a monitor
Custom data files are available on Postman paid plans. For more information, see the pricing page.
You can upload a data file to pass different sets of values to your requests and scripts during a monitor run. Postman substitutes the values for variables in requests or scripts in the monitored collection. By uploading a data file, you can run the collection multiple times with different data in a single monitor run.
Prepare your collection
Add variables to the requests in your collection. Variable names should match the fields in your data file. For example, if your file has a userId field, reference it as {{userId}} in a request URL. You can also access these values in pre-request and post-response scripts using pm.iterationData to access and manipulate variables. Learn more about using variables and referencing variables in Postman scripts.
Upload a data file
To upload a data file when configuring a monitor, do the following:
- Create or edit a monitor.
- Under Iteration data, click the dropdown list and select
Upload a datafile.
- Locate and open your CSV or JSON file. Data files are limited to 1 MB and a maximum of 50 data rows (CSV) or 50 objects (JSON). A preview of the file contents appears in the right pane.
- Complete the remaining monitor configuration and save the monitor.
Convert a data file to a dataset
After selecting a data file, you can click Save as dataset below the preview to convert it to a dataset. This enables you to query and reuse the data across other Postman workflows.
To convert the data file to a dataset, do the following:
- Enter a name for the dataset.
- Enter a name for the view.
- (Optional) Enter a description for the dataset.
- Click Save dataset.
After saving, the right pane shows a preview of the dataset view. From here, you can do the following:
- Edit the view and click Run to preview the results.
- Click Save to save your changes to the view.
- Click Set as new view to save the changes as a separate view. The monitor automatically switches to the new view.
- Click Reset to discard changes and return to the original view.
After converting a data file to a dataset, you can configure the iteration strategy for the monitor run. Learn more at Use a dataset with a monitor.
To learn how to add more data sources or update the view later, see Manage datasets.
Data file format
Data files can be in CSV or JSON format and must use the following structure:
-
CSV - The first row of the file must contain the variable names and one variable per column. Each following row is considered a data row, with values for each variable. Make sure all rows have the same number of columns and use a UNIX format line ending. Postman iterates through the data rows, running the monitored collection once for each data row in the file.
-
JSON - The file must be formatted as an array of objects containing the key-value pairs you want to use as variables. For each pair, the key corresponds to a variable name, and the value is used for that variable when running the monitored collection.