The Template block

Template block

The Template block enables you to insert variable values into a predefined text document and pass the value on to another block. For example, you could write a form letter and dynamically change placeholder variables for the customer name or sale item in the email.

You can also insert data blocks into the Template block to reference their data in the text or JSON as variables, such as the String, Bool, Number, or Select block. The values are injected into the text in placeholder variables surrounded with double curly braces.

Input

variable - When this port receives data, it assigns the data to a variable. You can then reference the variable in the text box with double curly braces like this: {{variable_name}}. You can also insert data blocks here and assign their values to variables.

Variables created in flows aren't available to post-response scripts or other features outside Postman Flows.

Text box - Enter text or JSON here. Select Text or JSON from the dropdown list at the top of the block to specify the input type. Selecting Text sends the input as a string from the Output port. Selecting JSON sends it as formatted JSON, which can be consumed by an HTTP Request or Select block. With a Select block, you can specify a path to retrieve specific data from the JSON.

Snippets - Select this dropdown list to add pre-defined text and variables to the Template block that you can edit for your use case. Choose from a Markdown document, an HTML email, or an SQL query.

Output

Output - Sends the information entered in the text box. Text input is sent as a string. JSON input is sent as formatted JSON.

Setup

Enter text in the text box and select the dropdown list at the top of the block to specify the input type. The Template block's output port will send text as a string and retain its formatting. It will send JSON as formatted JSON. Reference the Template block's variables with curly braces like this: {{variable_name}}.

To create a variable in the Template block, connect a block's output to the variable input port, or insert a block with Add data blocks Add data blocks. Change an inserted block to a different data block by selecting the inserted block's icon and choosing a block from the dropdown list.

Use Mustache syntax

The Template block supports Mustache syntax. You can use Mustache to dynamically format data, iterate over arrays, conditionally display text, and more.

If a referenced variable contains an object, Mustache syntax in the Template block returns the full JSON representation of the object, including field names, rather than [object Object].

Example

To see the Template block in an example flow, check out Flow Snippets: Template.

Last modified: 2025/07/23