Python endpoint discovery

    List Every FastAPI Endpoint and Find Routes Missing from OpenAPI

    FastAPI exposes its registered routes at runtime and generates OpenAPI automatically. That makes route inspection straightforward, but mounted applications, custom route classes, disabled schema inclusion, and stale deployment artifacts can still create differences between code, runtime, and the published specification.

    Direct framework method

    Start with the routes registered at runtime

    Inspect app.routes after every router and mounted application has been registered. Compare that runtime list with app.openapi()["paths"] to identify routes intentionally or accidentally omitted from the generated contract.

    FastAPI route inventory · python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    def list_routes(application: FastAPI) -> list[tuple[str, str, str]]:
        routes: list[tuple[str, str, str]] = []
        for route in application.routes:
            methods = ", ".join(sorted(route.methods or []))
            name = route.name or "unnamed"
            routes.append((methods, route.path, name))
        return routes
    
    for methods, path, name in list_routes(app):
        print(f"{methods:20} {path:40} {name}")

    Where a route-listing snippet stops

    • The application must import and start successfully before runtime inspection is complete.
    • Routes configured with include_in_schema=False are reachable but absent from generated OpenAPI.
    • Mounted sub-applications and dynamically registered routes require explicit traversal and verification.
    • A runtime list does not explain which source file or handler registered each route consistently.

    Use source as the second inventory

    APIScout reads supported FastAPI projects from source inside VS Code, links discovered routes to their implementation context, and exports an OpenAPI baseline without starting the service.

    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