Keys / SonarQube Cloud
SONAR_TOKEN
The SonarQube Cloud token your CI runs code analysis with. Scripts call the Web API with it too.
- Expires
- you choose; with no expiry, it ends after 60 days unused
- API
- create, list and revoke, with the Web API
Get it
Create one on sonarcloud.io/account/access-tokens. The steps aren't recorded yet.
Set it
SONAR_TOKEN=...
The SonarScanner CLI and the npm scanner read it when you don't pass sonar.token. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Generate a new token. Organization admins on the Team plan and up can create a Scoped Organization Token with the same projects and permissions; it starts with
sqco_and stays when its creator leaves. Users signed in with GitHub can create a personal token under My account > Access tokens. Either is shown once. - Put it in every CI secret named
SONAR_TOKEN. - Check that analyses still run, then revoke the old token.
- On GitHub Actions and GitLab CI, secretless analysis signs in with OpenID Connect and needs no stored token.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.
Sources, checked 2026-11-16
- SonarQube Cloud: Managing personal access tokens
- SonarQube Cloud: Scoped Organization Tokens
- SonarQube Cloud: GitHub Actions
- SonarQube Cloud: SonarScanner CLI
- SonarQube Cloud: Secretless analysis
- SonarQube Cloud Web API: api/user_tokens
- SonarQube Cloud API: Authentication domain (organization tokens)
- sonar-scanner-java-library: reads SONAR_TOKEN
- sonar-scanner-npm: reads SONAR_TOKEN