async def METHOD_NAME(request: Request) -> int:
    """Get the requested API version in a route handler.
    The route must depend on the ``check_version_header`` dependency.
    """
    assert isinstance(
        request.state.api_version, int
    ), "No api_version in request state; is endpoint properly configured?"
    return request.state.api_version