Script Postman visualizations

You can use the pm.visualizer object and the pm.getData method to visually represent your API’s request responses with the Postman Visualizer.

pm.visualizer

Use the pm.visualizer.set method to specify a template you want to use to display response data in the Postman Visualizer:

pm.visualizer.set(layout:String, data:Object, options:Object):Function

This method uses the following properties:

  • layout - (Required) A Handlebars HTML template string.
  • data - A JSON object that binds to the template. You can access it inside the template string.
  • options - An Options object for Handlebars.compile().

Example:

var template = `<p>{{res.info}}</p>`;
pm.visualizer.set(template, {
    res: pm.response.json()
});

pm.getData

Use the pm.getData method to get response data inside a Postman Visualizer template string.

pm.getData(callback):Function

The callback function accepts the following parameters:

  • error - Any error detail.
  • data - Data passed to the template by the pm.visualizer.set method.

Example:

pm.getData(function (error, data) {
  var value = data.res.info;
});

Last modified: 2025/11/04