SonarSource sources API

Get details on source files. See also api/tests.

Operations 3

GET /api/sources/raw Get source code as raw text. Require 'See Source Code' permission on file #
GET /api/sources/scm Get SCM information of source files. Require See Source Code permission on file's project Each element of the result ... #
GET /api/sources/show Get source code. Requires See Source Code permission on file's project, or organization membership on public projects... #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sonarsource-sources-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sonarsource-sources-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: SonarQube Cloud Web authentication Sources API
  version: v1
  description: The SonarQube Cloud Web API, derived faithfully from the machine-readable service catalog the instance publishes at /api/webservices/list.
  x-derived-from: https://sonarcloud.io/api/webservices/list
  contact:
    name: SonarSource
    url: https://community.sonarsource.com/
servers:
- url: https://sonarcloud.io
security:
- bearerToken: []
- basicToken: []
tags:
- name: sources
  description: Get details on source files. See also api/tests.
paths:
  /api/sources/raw:
    get:
      operationId: sourcesRaw
      summary: Get source code as raw text. Require 'See Source Code' permission on file
      description: Get source code as raw text. Require 'See Source Code' permission on file
      tags:
      - sources
      parameters:
      - name: branch
        in: query
        description: Branch key
        required: false
        schema:
          type: string
        example: feature/my_branch
      - name: key
        in: query
        description: File key
        required: true
        schema:
          type: string
        example: my_project:src/foo/Bar.php
      - name: pullRequest
        in: query
        description: Pull request id
        required: false
        schema:
          type: string
        example: '5461'
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized - authentication required
        '403':
          description: Insufficient privileges
        '404':
          description: Not Found
  /api/sources/scm:
    get:
      operationId: sourcesScm
      summary: Get SCM information of source files. Require See Source Code permission on file's project Each element of the result ...
      description: Get SCM information of source files. Require See Source Code permission on file's project Each element of the result array is composed of:Line numberAuthor of the commitDatetime of the commit (before 5.2 it was only the Date)Revision of the commit (added in 5.2)
      tags:
      - sources
      parameters:
      - name: commits_by_line
        in: query
        description: Group lines by SCM commit if value is false, else display commits for each line, even if two consecutive lines relate to the same commit.
        required: false
        schema:
          type: string
          enum:
          - 'true'
          - 'false'
          - 'yes'
          - 'no'
          default: 'false'
      - name: from
        in: query
        description: First line to return. Starts at 1
        required: false
        schema:
          type: string
          default: '1'
        example: '10'
      - name: key
        in: query
        description: File key
        required: true
        schema:
          type: string
        example: my_project:/src/foo/Bar.php
      - name: to
        in: query
        description: Last line to return (inclusive)
        required: false
        schema:
          type: string
        example: '20'
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized - authentication required
        '403':
          description: Insufficient privileges
        '404':
          description: Not Found
  /api/sources/show:
    get:
      operationId: sourcesShow
      summary: Get source code. Requires See Source Code permission on file's project, or organization membership on public projects...
      description: Get source code. Requires See Source Code permission on file's project, or organization membership on public projects. Each element of the result array is composed of:Line numberContent of the line
      tags:
      - sources
      parameters:
      - name: from
        in: query
        description: First line to return. Starts at 1
        required: false
        schema:
          type: string
          default: '1'
        example: '10'
      - name: key
        in: query
        description: File key
        required: true
        schema:
          type: string
        example: my_project:/src/foo/Bar.php
      - name: to
        in: query
        description: Last line to return (inclusive)
        required: false
        schema:
          type: string
        example: '20'
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized - authentication required
        '403':
          description: Insufficient privileges
        '404':
          description: Not Found
components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      description: User token as Bearer token.
    basicToken:
      type: http
      scheme: basic
      description: User token as HTTP Basic username with empty password.