You can pin variables in Postman Flows so they keep their values across different loop iterations. When a variable in a flow is pinned, its value persists through each iteration of the loop until a new value is explicitly set. Unpinned variables aren't retained after the iteration ends, or are reset at the beginning of the next iteration.
Unpinned variables offer flexibility for flows that use dynamic data processing, so that each iteration can adapt based on new inputs or changes in the workflow context. Unpinning is useful in loops where each pass requires fresh data or where the variable's value is updated often.
To pin or unpin a variable, select the pin icon.
A pinned variable defined outside of a loop retains its value in each iteration. If a pinned variable is both defined and used inside a loop, it will be destroyed and recreated in each iteration.
For example, this diagram shows an if loop with the pinned variable defined outside the loop:
The pinned variable retains its value in each iteration of the loop, so this loop will complete.
Conversely, this diagram shows an if loop with the pinned variable defined inside the loop:
The pinned variable is destroyed and recreated each time the loop iterates so the loop won't complete.
Last modified: 2024/03/15