Add code runner blocks to your notebook

You can add code snippets and reference their output elsewhere in your notebook to create an interactive experience. For example, you can add a code runner block that generates a random number and use that number in a request block that accepts one.

Add a code runner block

To add a code runner block, do the following:

  1. Open your notebook or create a new one.
  2. Place your cursor where you want to add the code runner block. Then, type a forward slash ("/"). Postman displays a block menu.
  3. Choose Run icon Code Runner Block.
  4. Name your code runner block.
  5. Write your code.
  6. Click Run icon Run.

You can reference your code runner block by name. For example, if you name your code runner block "randomNumber", you can reference its output in a request block with the syntax {{randomNumber}}. Or you can reference it in another code runner block with the syntax $randomNumber.

Last modified: 2025/07/28