Python endpoint discovery

List All Flask Routes Across Blueprints and Find Undocumented Endpoints

Flask keeps every registered URL rule in app.url_map and prints it with the built-in flask routes command. That answers what the running application registered, but Flask ships no OpenAPI document, blueprints are often registered conditionally, and the rule list says nothing about request bodies or authentication.

Direct framework method

Start with the routes registered at runtime

Run flask routes, or iterate app.url_map.iter_rules() after the application factory has registered every blueprint. Flask adds HEAD and OPTIONS to most rules automatically, so filter them out to see the methods your handlers actually implement.

Flask route inventory · python
from flask import Flask

app = Flask(__name__)

def list_routes(application: Flask) -> list[tuple[str, str, str]]:
    routes: list[tuple[str, str, str]] = []
    for rule in application.url_map.iter_rules():
        methods = ", ".join(sorted((rule.methods or set()) - {"HEAD", "OPTIONS"}))
        routes.append((methods, rule.rule, rule.endpoint))
    return sorted(routes, key=lambda route: route[1])

for methods, path, endpoint in list_routes(app):
    print(f"{methods:20} {path:40} {endpoint}")

Where a route-listing snippet stops

  • The application or its factory must import and initialize successfully, and flask routes has to locate it through --app, FLASK_APP, or an app.py or wsgi.py file.
  • Blueprints registered behind configuration flags or environment checks only appear in the environment where that condition is true.
  • Flask has no built-in OpenAPI document; extensions such as flask-smorest or Flasgger only describe the views they are told about.
  • A URL rule exposes a path, endpoint name, and methods, but not request schemas, authentication decorators, or the source file that defined the view.

Use source as the second inventory

APIScout analyzes supported Flask projects from source in VS Code, connects routes with implementation context, and creates an OpenAPI baseline without starting the application.

Review supported frameworks

Turn the inventory into a reviewable API contract

Export OpenAPI, review the endpoints with the team that owns them, and use the same contract for documentation and security testing.

Open the source-to-OpenAPI workflow