Assign input values with scenarios
Scenarios are sets of values assigned to Start or Schedule block inputs. You can define multiple scenarios with different values for inputs, and change between scenarios for different use cases. For example, scenarios are convenient when you’re testing flows that require the same inputs but different values for each test. You can also use datasets in your scenarios.
Scenarios are useful when you want to use different input values for a beta or production deployment. You can also reference environment variables and vault secrets in scenarios, or save input variables defined in a scenario to an environment.
When you add inputs to the Start block, Postman Flows creates a scenario named Start Trigger. Edit the Start Trigger scenario to assign values to the inputs. When the flow runs, the Start block passes each input to downstream blocks as a key-value pair, where the key is the input name and the value is the data received. For inputs that use environment variables or vault secrets, the Start block uses the values defined in the selected environment.
To learn more, see The Start block.
Schedule block scenarios
When you change the Start block to a Schedule block, Postman Flows creates a Schedule Trigger scenario with a startTime input. To set the value of the Schedule Trigger scenario’s timestamp, select one of the following from the startTime dropdown list:
- Current time - The Schedule Trigger scenario’s timestamp uses the current date and time each time the flow runs.
- Specific time - The Schedule Trigger scenario’s timestamp uses a specified date and time each time the flow runs.
To learn more, see The Schedule block.
MCP block scenarios
When you change the Start block to an MCP block, Postman Flows creates an MCP Trigger scenario with inputs for the request’s Headers, Params, and Body outputs.
To learn more, see The MCP block.
Create a scenario
Postman Flows automatically creates a scenario when you add inputs to a Start block or change the Start block to a Schedule or MCP block. You can edit these scenarios, or you can create a new scenario.
To create a new scenario, do the following:
-
If your flow has a Start block, add one or more inputs to the block.
-
In the right sidebar, click
Scenarios. -
Click
Create scenario. The scenario editor appears with editable fields for each of the trigger block’s inputs.
-
(Optional) Click
Add dataset > Select a dataset view to add a dataset view to your scenario. To learn more, see Datasets in scenarios.
-
Enter data for each input field. To reference environment variables or vault secrets, use double curly braces (
{{and}}). A list of available environment variables appears, select the one you need for your scenario. If you enter an environment variable, but are in a different or no environment, you’re prompted to select the one that contains the variable you want to reference, or create a new environment in which to save the variable. You can also type in a new variable within double curly braces and save it to a new or existing environment or vault if applicable. -
Click
Save.
Run a flow using scenario data
Once you’ve created a scenario, you can run the flow using the scenario’s data as values assigned to the trigger block’s inputs. To run a flow using a scenario’s data, do the following:
-
Click
Scenarios. -
Hover over the scenario you want to use and click
Run. The flow runs using data defined in the scenario.
Secrets in scenarios
When adding inputs to the Start block, you can set an input’s data type as Secret provided its value will be a string. Postman encrypts the values of Secret inputs and stores them securely, giving you a safe way to handle API keys or other sensitive values in your flows. Postman redacts them in run logs, Output blocks, and the Console, even when used in flows referenced by Flow blocks.
When you clone a flow that has a secret input, the input appears in the Start block and scenarios pane, but its value is left blank and is never present in the clone.
In the Scenarios pane, inputs designated as Secret in the Start block:
- Also have type
Secret.
- Are shown with their values masked by default.
What you can do with secret inputs depends on your permissions:
- Flow Editors can unmask secret inputs by clicking
Show. They can create, edit, and save secret input values.
- Runners can run flows with secret inputs, but can’t view their values. At runtime, Postman decrypts secret values if needed, without making them visible.
- Viewers can’t run flows with secret inputs, and can’t view the values of secret inputs.
Datasets in scenarios
When you use datasets in a scenario, you can assign a column from a dataset view to an input in the Start block. When you trigger the flow, it runs once per row in the dataset view, using the values in the assigned column as the input value for each run. This enables you to run a flow multiple times with different input values without having to create multiple scenarios. To learn more, see Test APIs with datasets in Postman.
To add a dataset to a scenario, do the following:
-
Click
Add dataset > Select a dataset view.
-
Select a dataset view from the dropdown list.
-
Click Column next to the input you want to assign a dataset column to, and select a column from the dropdown list. The flow will run once for each row in the column. The input’s value will iterate through the column’s values, using each value once per run.
-
You can enter static values for inputs with Value selected. These input values will remain the same each time the flow runs.
-
Click Save.
-
Hover over the scenario and click
Run all.
-
(Optional) Click
View run logs to view, filter, and download details about the dataset’s runs. Details include the input values used for each run, the output data, and any test results. To learn more, see Run logs.
Edit a scenario
You can change and save the values in a scenario. To edit a scenario, do the following:
-
Click
Scenarios. -
Hover over the scenario you want to edit and click Edit.
-
(Optional) Click
Add dataset > Select a dataset view to add a dataset view to your scenario. To learn more, see Datasets in scenarios.
-
Enter new values in the input fields, or select different environment variables.
-
Click Save.
Rename a scenario
You can change a scenario’s name. To rename a scenario, do the following:
-
Click
Scenarios. -
Hover over the scenario you want to rename and click
Scenario options > Rename.
-
Enter a new name.
-
Press the Return or Enter key.
Duplicate a scenario
You can make a copy of an existing scenario. To duplicate a scenario, do the following:
-
Click
Scenarios. -
Hover over the scenario you want to duplicate and click
Scenario options > Duplicate.
-
Click Save.
Delete a scenario
To delete a scenario, do the following:
-
Click
Scenarios. -
Hover over the scenario you want to delete and click
Scenario options > Delete.