# How to Create Self-Verifying API Workflows with Postman

Source: https://www.youtube.com/watch?v=V186qpoMrqA
Recap page: https://rapidrecap.app/video/V186qpoMrqA
Generated: 2025-11-12T18:06:51.302+00:00

---
## Quick Overview

The video successfully demonstrates how to create a self-verifying Retrieval Augmented Generation (RAG) workflow using Postman Flows, which integrates API calls to a knowledge base and an LLM mock to ensure generated answers are supported by factual context and citations, automatically flagging issues if documentation or API behavior changes.

**Key Points:**
- The RAG workflow uses the Postman Flow canvas to chain together four key API interactions: searching a knowledge base, capturing relevant documents, checking for document presence, and generating an answer via an LLM mock.
- The 'Search Knowledge Base' block queries a mock knowledge base API using inputs like 'question', 'topK' (set to 3 in the demo), 'kbUrl', and 'example'.
- The 'Check for Docs' block implements conditional logic to verify if the retrieval step returned any documents, branching to a fallback answer if none are found.
- The 'Apply Guardrails' block truncates long outputs and removes any sensitive data like API keys before sending the final prompt to the LLM mock.
- The final 'Generate Answer' block uses the retrieved context and the guarded prompt to produce an answer that includes verifiable citations, as shown in the results panel.
- The self-verifying aspect is achieved because if the retrieval step fails (e.g., due to API changes), the flow diverts to a fallback path, ensuring the LLM does not generate an answer without context.
- The entire workflow, built entirely inside Postman Flows, combines the clarity of a visual diagram with the reliability of executable tests.

![Screenshot at 00:00: Initial view of the completed visual API workflow diagram in Postman Flows, showing interconnected blocks for retrieval, processing, and generation steps.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-00-00.png)

**Context:** Technical Writer Melinda Gutermuth from Postman demonstrates building a complex Retrieval Augmented Generation (RAG) workflow directly within the Postman Flows environment. The goal is to create an executable, self-verifying workflow that first fetches relevant documentation snippets based on a user question, then uses those snippets to prompt a mock Large Language Model (LLM) to generate an accurate, cited answer, while also including guardrails and fallback logic.

## Detailed Analysis

Melinda Gutermuth walks through constructing a Retrieval Augmented Generation (RAG) workflow using Postman Flows, emphasizing that this approach makes documentation executable and testable. The workflow begins with a 'Start' block accepting inputs: 'question', 'topK' (set to 3 for the demo), 'kbUrl', and 'example'. The first step, 'Search Knowledge Base', calls a mock knowledge base API using the inputs to retrieve relevant documentation snippets. The flow then proceeds to 'Capture Docs' to process the API response, normalizing the retrieved documents into a usable format. Next, the 'Check for Docs' block acts as a conditional gate: if documents are found, the flow proceeds to generate an answer; if no documents are found, it follows a 'No Context' path to return a fallback answer. If context exists, the flow moves to 'Apply Guardrails', which truncates long outputs and redacts sensitive data before constructing the final prompt, which includes the retrieved context and the original question. This prompt is sent to the 'Generate Answer' mock LLM API. Finally, the 'Checks' block verifies that the generated answer includes at least one valid citation from the retrieved context. This entire process, built visually on the canvas, ensures that the LLM's output is grounded in the provided data, and the flow's structure allows for immediate detection and handling of failures if the underlying mock APIs change their routes or response shapes.

### Workflow Concept

- RAG workflow is demonstrated as a visual chain of API requests and logic blocks
- Inputs include question, topK (set to 3), kbUrl, and example
- The process moves from retrieval to context processing, answer generation, and final validation.

### Step 1

- Mocking the APIs: Two mock APIs are set up: 'Mock LLM API' for generating the final answer and 'KB Search' for retrieving documentation snippets, ensuring the flow is self-contained for testing.

### Step 2a

- Input Block Setup: The 'Start' block is configured to accept four inputs: question (string), topK (number, set to 3), kbUrl (string), and example (string).

### Step 2b

- Knowledge Base Retrieval: The 'Search Knowledge Base' block calls the mock KB search API, using flow variables mapped from the Start block inputs to fetch relevant documents.

### Step 2c

- Document Capture and Evaluation: The 'Capture Docs' block processes the results, and the 'Check for Docs' block uses JavaScript logic to branch the flow based on whether documents were successfully retrieved.

### Step 2e/2f

- Prompt Building and Generation: The 'Build Prompt' block combines the retrieved context snippets and the original question into a structured prompt, which is then sent to the 'Generate Answer' mock LLM.

### Step 2h

- Final Checks and Validation: The 'Checks' block verifies the LLM output, ensuring the answer includes at least one citation referencing the context provided, confirming successful RAG execution.

### Testing the Flow

- Running the flow retrieves two documents, builds the prompt, and the final result shows a generated answer with a citation linking back to the source context, proving the self-verifying mechanism works.

![Screenshot at 00:00: Initial view of the completed visual API workflow diagram in Postman Flows, showing interconnected blocks for retrieval, processing, and generation steps.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-00-00.png)
![Screenshot at 00:11: The 'Start' block being configured with initial inputs: question, topK, kbUrl, and example.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-00-11.png)
![Screenshot at 01:48: Step 1 highlighted: Mocking the APIs, showing the 'Mock LLM API' and 'KB Search' collections in the sidebar.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-01-48.png)
![Screenshot at 02:08: Step 2b: Adding the 'Search Knowledge Base' block and selecting the mock KB Search API request from the dropdown menu.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-02-08.png)
![Screenshot at 02:15: Step 2c: The 'Capture Docs' block configured with JavaScript to process the array of documents returned from the search step.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-02-15.png)
![Screenshot at 02:27: The flow branching logic in the 'Check for Docs' block, which determines if the retrieval was successful and routes the flow accordingly.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-02-27.png)
![Screenshot at 03:05: Step 2g: The 'Checks' block, which validates that the LLM response contains at least one citation.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-03-05.png)
![Screenshot at 03:32: The final, complete RAG workflow diagram showing all interconnected blocks leading to the 'Results' output.](https://ss.rapidrecap.app/screens/V186qpoMrqA/00-03-32.png)
