You can actually store all your request data, not just variables, in external files like CSV and JSON, and Postman will iterate through them for you.

Let’s see it in action. Imagine we have a simple API endpoint that takes a userId and postId to fetch a specific post.

Here’s how you’d set up a CSV file:

userId,postId
1,10
1,11
2,20
2,21

And here’s the equivalent JSON file, structured as an array of objects:

[
  {
    "userId": 1,
    "postId": 10
  },
  {
    "userId": 1,
    "postId": 11
  },
  {
    "userId": 2,
    "postId": 20
  },
  {
    "userId": 2,
    "postId": 21
  }
]

In Postman, you’d create a request and in the "Params" or "Body" tab (depending on how your API expects the data), you’d use double curly braces {{ }} to reference these values. For example, if you’re passing them as URL parameters:

https://api.example.com/posts/{{userId}}/{{postId}}

Or in the request body (e.g., JSON):

{

  "user": "{{userId}}",


  "post": "{{postId}}"

}

Then, you navigate to the "Runner" tab in Postman, select your collection or request, and under "Data," you choose "Select File." You upload your CSV or JSON file. Postman automatically detects the headers (for CSV) or keys (for JSON) and maps them to your {{variable}} names. When you click "Run," Postman executes the request once for each row in your CSV or each object in your JSON array, substituting the values.

This is fundamentally about parameterizing your entire request payload or query parameters for bulk testing, data-driven testing, or simulating multiple distinct users/scenarios without manually changing values each time. It decouples your test data from your test scripts, making both more maintainable and reusable. You can test edge cases, load testing scenarios, or simply verify your API behaves correctly with a wide range of inputs.

When using CSV, the first row is treated as the header, and these header names become the variable names in Postman. For JSON, Postman expects an array of objects, and the keys within each object become the variable names. If your JSON is structured differently, you might need a pre-request script to parse it into the expected format.

The most surprising thing is how seamlessly Postman handles CSV and JSON iteration. You don’t need to write loops or complex parsing logic within Postman itself. You simply define your variables using {{variableName}} in your request, upload the data file, and the runner takes care of the rest, executing the request for every data entry. This makes it incredibly powerful for generating large volumes of test data dynamically.

The next step is to explore how to combine data files with other Postman features like pre-request scripts for more complex data transformations.

Want structured learning?

Take the full Postman course →