> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Anti-patterns Results

> Retrieves the code anti-patterns and code smell detection results for a specific repository and commit



## OpenAPI

````yaml /openapi.json post /api/analysis/results/antipatterns
openapi: 3.0.3
info:
  title: CodeAnt AI API
  description: >-
    API for code analysis (SAST, SCA, secrets, IaC) and developer productivity
    metrics. Supports GitHub, GitLab, Bitbucket, and Azure DevOps.
  version: 1.0.0
servers:
  - url: https://api.codeant.ai
    description: Production server
security: []
tags:
  - name: Analysis
    description: Code analysis operations
  - name: Agent Analysis
    description: >-
      AI-powered agent analysis operations. Uses LLM-based code exploration
      agents to perform deep security threat hunting, bug finding, and custom
      analysis with reflection-based false positive filtering.
  - name: Developer Metrics — Teams
    description: >-
      Manage developer teams: create, update, delete teams and manage team
      membership. Teams are used to organize developers and scope metrics.
  - name: Developer Metrics
    description: >-
      Developer productivity and activity metrics: active developers, PR
      throughput, individual comparisons, and AI-generated summaries. All
      endpoints support GitHub, GitLab, Bitbucket, and Azure DevOps.
paths:
  /api/analysis/results/antipatterns:
    post:
      tags:
        - Analysis
      summary: Get Anti-patterns Results
      description: >-
        Retrieves the code anti-patterns and code smell detection results for a
        specific repository and commit
      operationId: getAntiPatternsResults
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AntiPatternsRequest'
            examples:
              github:
                summary: GitHub repository example
                value:
                  repo: owner/repository
                  commit_id: abc123def456
                  access_token: ghp_xxxxxxxxxxxx
                  service: github
      responses:
        '200':
          description: Anti-patterns results retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AntiPatternsResponse'
              example:
                results:
                  owner/repository/abc123def456/src/utils.py/anti_patterns.json:
                    - line_number: 42
                      endLine: null
                      issue_text: 'TODO: Implement timeout for requests'
                      type: CODE_SMELL
                      message-id: W0511
                      fixAvailable: false
                      symbol: fixme
                      column: 9
                      endColumn: null
                      severity: Minor
                      context_code_block: |-
                        def fetch_data(url):
                            headers = {"Authorization": f"Bearer {token}"}
                            # TODO: Implement timeout for requests
                            response = requests.get(url, headers=headers)
                            if response.status_code == 200:
                                return response.json()
                            return None
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Access token invalid
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Error retrieving anti-patterns results
components:
  schemas:
    AntiPatternsRequest:
      type: object
      required:
        - repo
        - access_token
        - service
      properties:
        repo:
          type: string
          description: Repository identifier (format varies by service)
          example: owner/repository
        commit_id:
          type: string
          description: >-
            Git commit SHA or identifier. Either commit_id or branch is
            required. If both are provided, commit_id takes precedence.
          example: abc123def456
        branch:
          type: string
          description: >-
            Git branch name. When provided without commit_id, the service
            resolves the latest commit from scan history for this branch. Either
            commit_id or branch is required.
          example: main
        access_token:
          type: string
          description: Authentication token for the service
          example: ghp_xxxxxxxxxxxx
        service:
          type: string
          description: Version control service provider
          enum:
            - github
            - azuredevops
            - gitlab
            - bitbucket
          example: github
        gitlab_base_url:
          type: string
          description: Base URL for the service (optional for GitHub, required for GitLab)
          example: https://gitlab.com
    AntiPatternsResponse:
      type: object
      description: Anti-patterns response containing detected code smells and anti-patterns
      properties:
        results:
          type: object
          description: Anti-patterns analysis results organized by file path
          additionalProperties:
            type: array
            description: List of anti-patterns detected in the file
            items:
              type: object
              properties:
                line_number:
                  type: integer
                  description: Starting line number where anti-pattern was found
                  example: 42
                endLine:
                  type: integer
                  nullable: true
                  description: Ending line number where anti-pattern was found
                  example: null
                issue_text:
                  type: string
                  description: Description of the anti-pattern issue
                  example: 'TODO: Implement timeout for requests'
                type:
                  type: string
                  description: Type of issue detected
                  enum:
                    - CODE_SMELL
                    - BUG
                    - VULNERABILITY
                    - SECURITY_HOTSPOT
                  example: CODE_SMELL
                message-id:
                  type: string
                  description: Unique identifier for the message type
                  example: W0511
                fixAvailable:
                  type: boolean
                  description: Whether an automated fix is available
                  example: false
                symbol:
                  type: string
                  description: Symbol or code identifier for the issue
                  example: fixme
                column:
                  type: integer
                  description: Starting column number
                  example: 9
                endColumn:
                  type: integer
                  nullable: true
                  description: Ending column number
                  example: null
                severity:
                  type: string
                  description: Severity level of the anti-pattern
                  enum:
                    - Critical
                    - Major
                    - Minor
                    - Info
                  example: Minor
                context_code_block:
                  type: string
                  description: Code block providing context around the issue
                  example: |-
                    def fetch_data(url):
                        headers = {"Authorization": f"Bearer {token}"}
                        # TODO: Implement timeout for requests
                        response = requests.get(url, headers=headers)
                        if response.status_code == 200:
                            return response.json()
                        return None
          example:
            owner/repository/abc123def456/src/utils.py/anti_patterns.json:
              - line_number: 42
                endLine: null
                issue_text: 'TODO: Implement timeout for requests'
                type: CODE_SMELL
                message-id: W0511
                fixAvailable: false
                symbol: fixme
                column: 9
                endColumn: null
                severity: Minor
                context_code_block: |-
                  def fetch_data(url):
                      headers = {"Authorization": f"Bearer {token}"}
                      # TODO: Implement timeout for requests
                      response = requests.get(url, headers=headers)
                      if response.status_code == 200:
                          return response.json()
                      return None
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message

````