Flask → Postman collection

Flask has no built-in schema, so most "export to Postman" guides start with installing flasgger or apispec. routeman reads app.url_map and your view code instead, and gives you a full Postman collection in one command.

$ pip install routeman && routeman generate

What routeman reads from a Flask app

Example

# app/auth.py
auth_bp = Blueprint("auth", __name__, url_prefix="/api/auth")

@auth_bp.post("/login")
def login():
    data = request.get_json()
    user = authenticate(data["username"], data["password"])
    return jsonify(access_token=create_access_token(identity=user.id))

# app/orders.py
bp = Blueprint("orders", __name__, url_prefix="/api/orders")

@bp.get("/")
@jwt_required()
def list_orders():
    page = request.args.get("page", 1, type=int)
    status = request.args.get("status")
    ...

@bp.post("/")
@jwt_required()
def create_order():
    data = request.get_json()
    product_id = int(data["product_id"])
    quantity = int(data.get("quantity", 1))
    note = data.get("note")
    ...

@bp.get("/<int:order_id>")
@jwt_required()
def get_order(order_id):
    ...

# app/__init__.py
def create_app():
    app = Flask(__name__)
    app.register_blueprint(auth_bp)
    app.register_blueprint(bp)
    return app
$ routeman generate -a "app:create_app()"
✓ flask: 5 requests (3 POST, 2 GET)
✓ auth: bearer (login: POST /api/auth/login)
✓ wrote postman/shop-api.postman_collection.json
✓ wrote postman/shop-api.local.postman_environment.json
  done in 0.15s - import the files in Postman (File → Import)

This is real output (the test app also had a /api/auth/register view). In Postman:

Application factories and .env

routeman finds a module-level app or a create_app() factory. If yours lives elsewhere, pass -a "package.module:create_app()". Settings from .env are loaded before the app is created, just like flask run with python-dotenv.

Full walkthrough: Flask API to Postman collection without Swagger.

Read the full docs