For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Postman
PricingEnterprise
Contact SalesSign InSign Up for Free
HomeDocs
HomeDocs
      • Overview
        • Overview
          • Overview
          • Rename headers
          • Detect session cookie
          • Route response data
        • Deployed flows overview
        • Connector blocks overview
Postman API Platform

Product

  • Postman Overview
  • Enterprise
  • Spec Hub
  • Flows
  • Agent Mode
  • API Catalog
  • Fern
  • Postman CLI
  • Integrations
  • Workspaces
  • Plans and pricing

API Network

  • App Security
  • Artificial Intelligence
  • Communication
  • Data Analytics
  • Database
  • Developer Productivity
  • DevOps
  • Ecommerce
  • eSignature
  • Financial Services
  • Payments
  • Travel

Resources

  • Postman Docs
  • Academy
  • Community
  • Templates
  • Intergalactic
  • Videos
  • MCP Servers

Legal and Security

  • Legal Terms Hub
  • Terms of Service
  • Postman Product Terms
  • Security
  • Website Terms of Use

Company

  • About
  • Careers and culture
  • Contact us
  • Partner program
  • Customer stories
  • Student programs
  • Press and media
Twitter iconLinkedIn iconGithub iconYouTube iconInstagram iconDiscord icon
Download Postman
Privacy Policy

© 2026 Postman, Inc.

On this page
  • Example JSON
  • Condition 1: Check for critical server errors
  • Condition 2: Check for slow response
  • Condition 3: Not JSON
  • Example
Postman FlowsFlows referenceTypeScript in flows

Route response data with TypeScript in Flows

||View as Markdown|
Was this page helpful?
Previous

Detect a session id cookie with TypeScript in Flows

Next

Introduction to Flows Query Language

Built with

This example uses three TypeScript expressions to route response data based on health and performance using a Condition block. The first expression to return true routes the response data through its output port. If none of the three TypeScript expressions resolve to true, the Condition block routes the response data through the Default output port.

Example JSON

The example uses JSON data from a GET request to postman-echo.com like this:

1{
2 "body": {
3 "args": {},
4 "headers": {
5 "host": "postman-echo.com",
6 "x-request-start": "t1757972551.591",
7 "connection": "close",
8 "x-forwarded-proto": "https",
9 "x-forwarded-port": "443",
10 "x-amzn-trace-id": "Root=1-68c88847-aaaaaaaaaaaaaaaaaaaaaaaa",
11 "user-agent": "PostmanRuntime/7.46.0",
12 "accept": "*/*",
13 "cache-control": "no-cache",
14 "postman-token": "00000000-1111-2222-3333-444444444444",
15 "accept-encoding": "gzip, deflate, br",
16 "cookie": "sails.sid=s%3AdummySessionId1234567890.abcdef1234567890"
17 },
18 "url": "https://postman-echo.com/get"
19 },
20 "http": {
21 "status": 200,
22 "headers": {
23 "Date": "Mon, 15 Sep 2025 21:42:31 GMT",
24 "Content-Type": "application/json; charset=utf-8",
25 "Content-Length": "621",
26 "Connection": "keep-alive",
27 "Server": "nginx",
28 "ETag": "W/"26d-FAKEETAG1234567890"",
29 "Set-Cookie": "sails.sid=s%3AdummySetCookieId0987654321.qwerty9876543210; Path=/; HttpOnly"
30 }
31 },
32 "tests": [],
33 "binary": false
34}

Condition 1: Check for critical server errors

The TypeScript in this condition finds the response’s status code and checks if the code is greater than or equal to 400:

1response.http.status >= 400

Condition 2: Check for slow response

The TypeScript in this condition finds the Server-Timing header value and checks if it’s greater than 1000. The Server-Timing header shows the number of milliseconds the request took to process. If it’s greater than 1000 ms, that could indicate a slow response.

1Number((response.http.headers["Server-Timing"] || "")
2 .match(/dur=([\d.]+)/)?.[1]) > 1000

Condition 3: Not JSON

The TypeScript in this condition checks if the Content-Type header is missing the string application/json. If application/json isn’t present in the header, the expression returns true and routes the response from this condition’s output port. If the string is present, the expression returns false.

1!(response.http.headers["Content-Type"]?.includes("application/json"))

Example

To see this TypeScript in an example flow, check out TypeScript example 3: Response health and performance routing.