SonarQube API

Development / OAuth Advanced HTTPS
46 D
Measured Score 0 50 100 Speed 3/30 Consistency 4/20 Security 16/20 Browser access 15/15 Transparency 8/15 TESTED 2026-08-10

Overview

SonarQube provides a REST API for its code quality and security analysis platform, letting you programmatically retrieve metrics, issues, and quality gate statuses for your projects. It supports OAuth authentication and integrates with CI/CD pipelines to automate code review workflows. Developers use it to build dashboards, enforce quality gates, and track technical debt over time.

Beginner Tip

You can explore the SonarCloud Web API interactively at sonarcloud.io/web_api without writing any code — a great way to understand available endpoints before integrating them into your pipeline.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://sonarcloud.io/api/
Result
HTTP 200 · application/json · 209,730 bytes · compressed
Response time
920 ms (median of 3) · fastest 531 ms
Transport
TLSv1.3 · TLS_AES_128_GCM_SHA256
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
webServices array [1 item]

Captured Response

Captured from a real request to https://sonarcloud.io/api/ on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "webServices": [
    {
      "path": "api/authentication",
      "description": "Handle authentication.",
      "actions": [
        {
          "…": "(7 more fields)"
        }
      ]
    }
  ]
}

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://sonarcloud.io/api/measures/component?component=YOUR_PROJECT_KEY&metricKeys=coverage,bugs,code_smells";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "Authorization": "Bearer YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{
  "errors": [
    {
      "msg": "Unknown url : /api/apisscore-nonexistent-path"
    }
  ]
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

401 Unauthorized Token not included or formatted incorrectly in the Authorization header
Pass your SonarCloud token as the username with a blank password using -u YOUR_TOKEN: in curl (note the trailing colon)
404 Not Found on component The project key does not exist or you do not have access to it
Verify the project key in your SonarCloud dashboard under Administration > Update Key
400 Bad Request on metricKeys One or more metric key names are invalid
Use the /api/metrics/search endpoint to get a full list of valid metric keys for your SonarCloud instance

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 3/30
Consistency 4/20
Security 16/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 920ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth OAuth
HTTPS REQUIRED
CORS UNKNOWN
Category Development
Difficulty Advanced
Endpoint last called: 2026-08-10

Similar APIs

View All →