# Create & Sync API Collections From Backend Code with Agent Mode

Source: https://www.youtube.com/watch?v=wOWuIQOUFYg
Recap page: https://rapidrecap.app/video/wOWuIQOUFYg
Generated: 2025-11-19T23:04:00.832+00:00

---
## Quick Overview

The video demonstrates successfully connecting a Postman workspace to a local file system and using Agent Mode to automatically generate and update an API collection (Feature Flags API) based on changes detected in the backend Flask application code (app.py), subsequently creating a new request for a disabled feature flag endpoint.

**Key Points:**
- The Postman workspace successfully connected to the local file system, allowing Agent Mode to scan and detect API definitions from the backend Flask application file, app.py.
- Agent Mode automatically created a Postman collection named "Feature Flags API (from app.py)" containing endpoints discovered in the Flask code, including GET, POST, and DELETE methods for feature flags.
- The initial collection was missing the POST request for disabling a feature flag, which the user then manually added as a requested next step.
- After adding the new POST endpoint to app.py and instructing Agent Mode to update the collection, the agent successfully synchronized the changes, adding the missing endpoint and updating other request details.
- The final synchronization confirmed the backend was synced with the latest collection updates, noting specific changes like GET support for filtering enabled/disabled flags.
- The process showcases the workflow of keeping Postman collections synchronized with backend code changes using the filesystem connection and Agent Mode.

![Screenshot at 0:05: The initial step where the user selects the 'Connect' button to link the current Postman workspace to the local file system, initiating the synchronization process.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-05.png)

**Context:** This tutorial demonstrates an advanced workflow within Postman, specifically utilizing the 'API Network' feature that allows connecting a Postman workspace directly to a local file system. The goal is to leverage Postman's Agent Mode to automatically scan source code (here, a Flask application defined in app.py) and generate or update a corresponding API collection, thereby ensuring the collection accurately reflects the current backend API structure.

## Detailed Analysis

The demonstration begins by connecting the Postman workspace to the local file system containing a 'feature-flags-prod' directory, which holds a Flask application defined in 'app.py'. Upon successful connection, the user chooses to use 'Agent Mode' to generate a collection from the filesystem. Agent Mode scans 'app.py', detects the Flask API endpoints, and creates a Postman collection named 'Feature Flags API (from app.py)'. The initial comparison shows that all detected endpoints are present except for POST /featureflags/:flag_id/disable. The user then manually adds this missing endpoint definition to the 'app.py' file. After saving the code change, the user instructs Agent Mode to update the collection based on the modified backend code. The debug log confirms that Agent Mode reads the updated files, finds the new endpoint, and regenerates the collection, successfully incorporating the 'Disable feature flag' request. The final output confirms the backend is now synced with the latest collection updates, highlighting changes like enhanced GET support and updated base URLs, illustrating a seamless, code-driven API collection management lifecycle.

### Workspace Setup & Initial Scan

- Connecting workspace to filesystem at /Users/tala/Postman/feature-flags-prod
- Agent Mode scans app.py and detects Flask API definitions
- Initial collection generated: Feature Flags API (from app.py)

### Initial Collection Review

- Discovered endpoints include GET /featureflags, POST /featureflags, DELETE /featureflags/:flag_id, and POST /featureflags/:flag_id/enable
- Missing endpoint: POST /featureflags/:flag_id/disable

### Backend Code Modification

- User manually adds the missing POST /featureflags/:flag_id/disable function to the backend app.py file
- User saves changes and prompts Agent Mode to update the collection.

### Collection Update via Agent Mode

- Agent Mode reads config.json and app.py, detects changes, and regenerates the collection
- The missing POST endpoint for disabling feature flags is now included in the collection.

### Final Synchronization & Results

- Debug log confirms the backend is synced with collection updates
- Noteworthy updates include GET support for filtering enabled/disabled flags and updated base URL to match the application's running port (5000).

![Screenshot at 0:01: Opening the file system browser within Postman to select the project folder for connection.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-01.png)
![Screenshot at 0:05: The interface showing the options to 'Setup from Workspace' or 'Create with Agent Mode' after filesystem connection.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-05.png)
![Screenshot at 0:08: Confirmation message stating 'Workspace Connected Successfully', indicating the file system link is active.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-08.png)
![Screenshot at 0:10: User selects 'Use Agent Mode' to initiate the automatic collection generation process based on code.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-10.png)
![Screenshot at 0:24: The generated summary showing the detected endpoints, variables, and proposed next steps for collection refinement.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-24.png)
![Screenshot at 0:36: The generated 'Feature Flags API \(from app.py\)' collection appearing in the left sidebar after Agent Mode processing.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-36.png)
![Screenshot at 0:51: Viewing the generated collection JSON file \(Feature Flags API postman\_collection.json\) showing the initial structure.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-00-51.png)
![Screenshot at 1:04: User manually adding the missing POST function to disable a feature flag within the app.py source code.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-01-04.png)
![Screenshot at 1:41: The updated collection in the sidebar now showing the newly added 'POST Disable feature flag' request.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-01-41.png)
![Screenshot at 2:03: The final collection view displaying the newly added 'GET disabled feature flags' request automatically generated by Agent Mode.](https://ss.rapidrecap.app/screens/wOWuIQOUFYg/00-02-03.png)
