Codacy Repositories API

Repository management and analysis state.

OpenAPI Specification

codacy-repositories-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Codacy Account Repositories API
  description: Codacy API v3 for managing organizations, repositories, issues, pull requests, coverage, security, and quality settings on the Codacy automated code quality and security platform. All authenticated endpoints use an account API token passed in the api-token header.
  termsOfService: https://www.codacy.com/terms
  contact:
    name: Codacy Support
    url: https://www.codacy.com
    email: support@codacy.com
  version: '3.0'
servers:
- url: https://api.codacy.com/api/v3
  description: Codacy Cloud API v3
security:
- api-token: []
tags:
- name: Repositories
  description: Repository management and analysis state.
paths:
  /analysis/organizations/{provider}/{remoteOrganizationName}/repositories:
    get:
      operationId: listOrganizationRepositoriesWithAnalysis
      tags:
      - Repositories
      summary: List an organization's repositories with their analysis state.
      parameters:
      - $ref: '#/components/parameters/provider'
      - $ref: '#/components/parameters/remoteOrganizationName'
      - $ref: '#/components/parameters/cursor'
      - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: A paginated list of repositories with analysis.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryWithAnalysisListResponse'
  /analysis/organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}:
    get:
      operationId: getRepositoryWithAnalysis
      tags:
      - Repositories
      summary: Get a repository with its analysis state.
      parameters:
      - $ref: '#/components/parameters/provider'
      - $ref: '#/components/parameters/remoteOrganizationName'
      - $ref: '#/components/parameters/repositoryName'
      responses:
        '200':
          description: The repository with analysis.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryWithAnalysisResponse'
  /organizations/{provider}/{remoteOrganizationName}/repositories/{repositoryName}/follow:
    post:
      operationId: followAddedRepository
      tags:
      - Repositories
      summary: Follow a repository already added to Codacy.
      parameters:
      - $ref: '#/components/parameters/provider'
      - $ref: '#/components/parameters/remoteOrganizationName'
      - $ref: '#/components/parameters/repositoryName'
      responses:
        '204':
          description: The repository is now followed.
    delete:
      operationId: unfollowRepository
      tags:
      - Repositories
      summary: Unfollow a repository.
      parameters:
      - $ref: '#/components/parameters/provider'
      - $ref: '#/components/parameters/remoteOrganizationName'
      - $ref: '#/components/parameters/repositoryName'
      responses:
        '204':
          description: The repository is no longer followed.
components:
  schemas:
    Repository:
      type: object
      properties:
        repositoryId:
          type: integer
          format: int64
        provider:
          type: string
        owner:
          type: string
        name:
          type: string
        fullPath:
          type: string
        visibility:
          type: string
        defaultBranch:
          type: object
          properties:
            name:
              type: string
            branchId:
              type: integer
              format: int64
    PaginationInfo:
      type: object
      properties:
        cursor:
          type: string
        limit:
          type: integer
        total:
          type: integer
    RepositoryWithAnalysis:
      type: object
      properties:
        repository:
          $ref: '#/components/schemas/Repository'
        grade:
          type: integer
        gradeLetter:
          type: string
        issuesPercentage:
          type: number
        coverage:
          type: object
          properties:
            filesUncovered:
              type: integer
            filesWithLowCoverage:
              type: integer
            coveragePercentage:
              type: number
        lastAnalysedCommit:
          type: string
    RepositoryWithAnalysisResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/RepositoryWithAnalysis'
    RepositoryWithAnalysisListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/RepositoryWithAnalysis'
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
  parameters:
    cursor:
      name: cursor
      in: query
      required: false
      description: Cursor for the next page of results.
      schema:
        type: string
    repositoryName:
      name: repositoryName
      in: path
      required: true
      description: Repository name on the Git provider.
      schema:
        type: string
    limit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return (max 1000).
      schema:
        type: integer
        default: 100
        maximum: 1000
    provider:
      name: provider
      in: path
      required: true
      description: Git provider code (gh, ghe, gl, gle, bb, bbe).
      schema:
        type: string
        enum:
        - gh
        - ghe
        - gl
        - gle
        - bb
        - bbe
    remoteOrganizationName:
      name: remoteOrganizationName
      in: path
      required: true
      description: Organization name on the Git provider.
      schema:
        type: string
  securitySchemes:
    api-token:
      type: apiKey
      in: header
      name: api-token
      description: Account API token created in your Codacy account settings.