Ah, sorry forgot to mention the syntax is wrong, this should be
curl -u <token>: -X POST “http://$SONAR_IP:9000/api/projects/create?name=demoproject&project=demoproject&mainBranch=develop"
and the web api has no parameter named key, see
https://<yoursonarhost>/web_api/api/projects/create
Sonarqube 9.9 LTS
Sonarqube 10.3 latest