SonarQube Projects API

Project creation, search, and management

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

sonarqube-projects-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: SonarQube Web Projects API
  description: The SonarQube Web API provides HTTP endpoints for programmatic interaction with SonarQube Server. It enables management of projects, quality gates, issues, rules, users, groups, permissions, and CI/CD integrations. The API uses token-based authentication and follows REST conventions. It powers the SonarQube web UI and is used for CI/CD integration, custom tooling, and third-party plugin development.
  version: 10.0.0
  contact:
    name: SonarSource
    url: https://community.sonarsource.com/
  license:
    name: GNU Lesser General Public License v3.0
    url: https://www.gnu.org/licenses/lgpl-3.0.html
servers:
- url: https://{sonarqubeHost}/api
  description: SonarQube Server
  variables:
    sonarqubeHost:
      default: sonarqube.example.com
      description: Hostname of your SonarQube instance
tags:
- name: Projects
  description: Project creation, search, and management
paths:
  /projects/search:
    get:
      operationId: searchProjects
      summary: Search Projects
      description: Search for projects and components on the SonarQube instance. Supports filtering by organization, quality gate, languages, tags, and analysis date. Returns paginated results with component details.
      tags:
      - Projects
      parameters:
      - name: q
        in: query
        description: Search query to filter projects by name or key
        schema:
          type: string
      - name: p
        in: query
        description: Page number (1-based)
        schema:
          type: integer
          default: 1
      - name: ps
        in: query
        description: Page size (max 500)
        schema:
          type: integer
          default: 100
      - name: filter
        in: query
        description: Filter string (e.g. alert_status=OK)
        schema:
          type: string
      - name: qualitygate
        in: query
        description: Filter by quality gate name
        schema:
          type: string
      security:
      - basicAuth: []
      - bearerAuth: []
      responses:
        '200':
          description: Successfully retrieved list of projects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectSearchResponse'
        '401':
          description: Unauthorized
  /projects/create:
    post:
      operationId: createProject
      summary: Create Project
      description: Create a new project in SonarQube. Sets the project key, name, visibility (public/private), and optional quality profile associations.
      tags:
      - Projects
      security:
      - basicAuth: []
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateProjectRequest'
      responses:
        '200':
          description: Project created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectCreateResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
  /projects/delete:
    post:
      operationId: deleteProject
      summary: Delete Project
      description: Delete a project and all its associated data including analysis history, issues, and quality gate status.
      tags:
      - Projects
      security:
      - basicAuth: []
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - project
              properties:
                project:
                  type: string
                  description: Project key
      responses:
        '204':
          description: Project deleted successfully
        '401':
          description: Unauthorized
        '404':
          description: Project not found
components:
  schemas:
    ProjectSearchResponse:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/Paging'
        components:
          type: array
          items:
            $ref: '#/components/schemas/Project'
    Project:
      type: object
      properties:
        key:
          type: string
          description: Project key (unique identifier)
        name:
          type: string
          description: Project display name
        qualifier:
          type: string
          enum:
          - TRK
          - APP
          - VW
          description: Component qualifier
        visibility:
          type: string
          enum:
          - public
          - private
        lastAnalysisDate:
          type: string
          format: date-time
          description: Timestamp of the last analysis
        revision:
          type: string
          description: SCM revision of last analysis
        managed:
          type: boolean
          description: Whether the project is externally managed
    CreateProjectRequest:
      type: object
      required:
      - project
      - name
      properties:
        project:
          type: string
          description: Project key (unique, alphanumeric, dashes, underscores)
        name:
          type: string
          description: Project display name
        visibility:
          type: string
          enum:
          - public
          - private
          description: Project visibility
        mainBranch:
          type: string
          description: 'Name of the main branch (default: main)'
    ProjectCreateResponse:
      type: object
      properties:
        project:
          $ref: '#/components/schemas/Project'
    Paging:
      type: object
      properties:
        pageIndex:
          type: integer
          description: Current page number
        pageSize:
          type: integer
          description: Number of items per page
        total:
          type: integer
          description: Total number of items
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Basic authentication using a user token as the username and an empty password. Generate tokens in User > My Account > Security.
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication using a SonarQube user token.