Cannot pass multiple query string paramters to GitLab API

You need double quotes (") around any url with an &. So your curl request needs to be:

curl --request GET --header "PRIVATE-TOKEN: ${token}" "https://my.self.hosted.gitlab/api/v4/projects/${myProject}/repository/tree?ref=mybranch&path=root/sub/sub"

Also note correction to --header quotes to interpolate the token variable.