How do I script linking a SonarCloud project to a Bitbucket Cloud repo

I already programmatically create new sonar projects with the REST API:

Im setting all these values in the scanner command. everything works except it looks like I still have to link it to the BB repo to get the widget?

// sonar project key

// project name- human readable project name that appears in the UI

// scan version

// sonarcloud token

// sonarcloud org

// coverage report

// Bitbucket branch and PR

// PR decorator. So sonarqube can post build status to the PR in bitbucket

When i look at SonarCloud setting it says “To display the quality of your repository, you have to link it with a project analyzed on SonarCloud.”

I dont want to manually do that for every one of my repos especially because ive automated everything up to this point

Hi @red_888,

Welcome to our community!

For now it is not possible to script the link between a BitBucketCloud repo and a SonarCloud project.
We would like to provide the ability to onboard on SonarCloud via an API, but it will not be available in the short term.