Web API

How to use SonarQube Cloud’s Web API.

SonarQube Cloud offers a Web API, allowing external applications to access its features. The base URL for accessing the API depends on whether you are using the SonarQube Cloud’s EU or US instance:

circle-exclamation

Web API documentation

The SonarQube Cloud’s Web API v2 documentation is available herearrow-up-right.

The web services composing the Web API v1 are documented within SonarQube Cloud, through the URL https://sonarcloud.io/web_apiarrow-up-right.

You can also access the Web API documentation from the top bar in Cloud by selecting the help button.

Select the help menu (question mark icon) in the top right corner.

Authenticating to the Web API

Administrative web services are secured and require the user to have specific permissions.

To authenticate to the Web API, we recommend that you use the bearer authentication schemearrow-up-right. With this scheme, a SonarQube Cloud token is used:

Sending an API request

To make a request, you need to find the SonarQube Cloud API and the right path for the operation that you want to use. The following APIs are available:

  • Analysis

  • Authentication domain

  • Audit logs

  • AICA (AI Code Assurance)

  • Enterprises, Reports, Portfolios, Portfolio Permission Templates

  • Organizations

  • Projects

  • Quality Gates

  • SCA (Software Composition Analysis)

  • Software Quality Reports

  • Users and roles

Sample request

The code block below shows a request with cURL.

Where <domain> is:

  • For the EU instance: sonarcloud.io

  • For the US instance: sonarqube.us

Example:

circle-info

For more information about API request and response, see the SonarQube Cloud’s Web API v2 documentationarrow-up-right.

Taking into account the API rate limiting

Some of SonarQube Cloud’s APIs are rate-limited in order to ensure that we can continue to deliver the service smoothly and with optimum performance. In most cases, you should take this into account when automating tasks and processes by using the SonarQube Cloud Web API.

Your API calls will fail with a 429 status code when the rate limit has been reached. If this happens, wait a few minutes before retrying the operation.

Last updated

Was this helpful?