{
  "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"
    }
  ],
  "paths": {
    "/api/analysis/start": {
      "post": {
        "summary": "Start Analysis",
        "description": "Initiates a background analysis task for a repository",
        "operationId": "startAnalysis",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalysisStartRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github",
                    "branch": "main",
                    "include_files": "src/**/*.py,lib/**/*.js,app/**/*.ts",
                    "exclude_files": "tests/**,node_modules/**,dist/**"
                  }
                },
                "azuredevops": {
                  "summary": "Azure DevOps repository example",
                  "value": {
                    "repo": "organization/project/repository",
                    "commit_id": "abc123def456",
                    "access_token": "pat_xxxxxxxxxxxx",
                    "service": "azuredevops",
                    "branch": "main",
                    "include_files": "src/**/*.cs,src/**/*.js",
                    "exclude_files": "tests/**,bin/**,obj/**"
                  }
                },
                "sca_only": {
                  "summary": "SCA-only scan",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "",
                    "access_token": "cdt_xxxxxxxxxxxx",
                    "service": "github",
                    "branch": "main",
                    "scan_types": [
                      "sca"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Analysis successfully started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                },
                "example": {
                  "message": "Analysis started"
                }
              }
            }
          },
          "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 running analysis"
                }
              }
            }
          },
          "400": {
            "description": "Unknown scan type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Unknown scan_types: ['dast']. Valid: ['secrets', 'sast', 'sca', 'iac', 'sbom', 'duplicate_code', 'docstring', 'antipatterns', 'dead_code']"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results": {
      "post": {
        "summary": "Get Analysis Results",
        "description": "Retrieves the analysis results for a specific repository and commit",
        "operationId": "getAnalysisResults",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalysisResultsRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github"
                  }
                },
                "azuredevops": {
                  "summary": "Azure DevOps repository example",
                  "value": {
                    "repo": "organization/project/repository",
                    "commit_id": "abc123def456",
                    "access_token": "pat_xxxxxxxxxxxx",
                    "service": "azuredevops"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Analysis results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalysisResults"
                },
                "example": {
                  "security_issues": [
                    {
                      "type": "SQL Injection",
                      "severity": "high",
                      "file": "src/database.py",
                      "line": 42,
                      "description": "Potential SQL injection vulnerability"
                    }
                  ],
                  "summary": {
                    "total_issues": 1,
                    "high_severity": 1,
                    "medium_severity": 0,
                    "low_severity": 0
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Access token invalid"
                }
              }
            }
          },
          "404": {
            "description": "No scan results found for the provided branch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "No scan results found for branch 'main'",
                  "message": "No scans have been run for this branch"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results/sbom": {
      "post": {
        "summary": "Get SBOM Results",
        "description": "Retrieves the Software Bill of Materials (SBOM) results for a specific repository and commit",
        "operationId": "getSBOMResults",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SBOMRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SBOM results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SBOMResponse"
                },
                "example": {
                  "results": {
                    "rootFolder": "/mnt/lambda/owner/repository/abc123def456",
                    "timestamp": null,
                    "sboms": [
                      {
                        "language": "Python",
                        "sourceFile": "/tmp/requirements.txt",
                        "packages": [
                          {
                            "name": "requests",
                            "version": "2.28.0",
                            "licenseDeclared": "Apache-2.0",
                            "licenseConcluded": "Apache-2.0",
                            "licenseReason": "NOASSERTION",
                            "licenseStandard": true,
                            "copyleftStrength": "permissive",
                            "policyLevel": "allow",
                            "policyNote": "Permissive license: keep license and notices",
                            "spdxId": "Apache-2.0"
                          }
                        ],
                        "packagesCount": 1
                      }
                    ]
                  },
                  "status": "done",
                  "commit_id": "abc123def456"
                }
              }
            }
          },
          "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 SBOM results"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results/secrets": {
      "post": {
        "summary": "Get Secrets Scan Results",
        "description": "Retrieves the secrets scanning results for a specific repository and commit",
        "operationId": "getSecretsResults",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretsRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Secrets scan results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretsResponse"
                },
                "example": {
                  "results": {
                    "secrets": [
                      {
                        "type": "Secret Keyword",
                        "filename": "/mnt/lambda/owner/repository/abc123def456/src/config.py",
                        "hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
                        "is_verified": false,
                        "line_number": 14,
                        "confidence_score": "FALSE_POSITIVE"
                      }
                    ],
                    "secretsCount": 1
                  },
                  "status": "done",
                  "commit_id": "abc123def456"
                }
              }
            }
          },
          "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 secrets scan results"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results/antipatterns": {
      "post": {
        "summary": "Get Anti-patterns Results",
        "description": "Retrieves the code anti-patterns and code smell detection results for a specific repository and commit",
        "operationId": "getAntiPatternsResults",
        "tags": [
          "Analysis"
        ],
        "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):\n    headers = {\"Authorization\": f\"Bearer {token}\"}\n    # TODO: Implement timeout for requests\n    response = requests.get(url, headers=headers)\n    if response.status_code == 200:\n        return response.json()\n    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"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results/iac": {
      "post": {
        "summary": "Get IaC Scan Results",
        "description": "Retrieves Infrastructure as Code (IaC) security scanning results for a specific repository and commit",
        "operationId": "getIaCResults",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IaCRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "IaC scan results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IaCResponse"
                },
                "example": {
                  "results": [
                    {
                      "check_type": "terraform",
                      "results": {
                        "failed_checks": [
                          {
                            "bc_check_id": "BC_AWS_NETWORKING_31",
                            "check_id": "CKV_AWS_23",
                            "check_name": "Ensure every security group and rule has a description",
                            "file_path": "/owner/repository/abc123def456/terraform/main.tf",
                            "file_line_range": [
                              2,
                              25
                            ],
                            "check_class": "checkov.terraform.checks.resource.aws.SecurityGroupRuleDescription",
                            "code_block": [
                              [
                                2,
                                "resource \"aws_security_group\" \"web\" {\n"
                              ],
                              [
                                3,
                                "  name_prefix = \"web-sg\"\n"
                              ],
                              [
                                4,
                                "\n"
                              ],
                              [
                                5,
                                "  ingress {\n"
                              ],
                              [
                                6,
                                "    from_port   = 22\n"
                              ],
                              [
                                7,
                                "    to_port     = 22\n"
                              ],
                              [
                                8,
                                "    protocol    = \"tcp\"\n"
                              ],
                              [
                                9,
                                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
                              ],
                              [
                                10,
                                "  }\n"
                              ],
                              [
                                11,
                                "\n"
                              ],
                              [
                                12,
                                "  ingress {\n"
                              ],
                              [
                                13,
                                "    from_port   = 80\n"
                              ],
                              [
                                14,
                                "    to_port     = 80\n"
                              ],
                              [
                                15,
                                "    protocol    = \"tcp\"\n"
                              ],
                              [
                                16,
                                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
                              ],
                              [
                                17,
                                "  }\n"
                              ],
                              [
                                18,
                                "\n"
                              ],
                              [
                                19,
                                "  egress {\n"
                              ],
                              [
                                20,
                                "    from_port   = 0\n"
                              ],
                              [
                                21,
                                "    to_port     = 0\n"
                              ],
                              [
                                22,
                                "    protocol    = \"-1\"\n"
                              ],
                              [
                                23,
                                "    cidr_blocks = [\"0.0.0.0/0\"]\n"
                              ],
                              [
                                24,
                                "  }\n"
                              ],
                              [
                                25,
                                "}\n"
                              ]
                            ],
                            "resource": "aws_security_group.web",
                            "start_line": 2,
                            "end_line": 25
                          }
                        ]
                      }
                    }
                  ]
                }
              }
            }
          },
          "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 IaC scan results"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/results/full_report": {
      "post": {
        "summary": "Get Full Analysis Report",
        "description": "Generates a sectioned CSV analysis report for a specific repository and commit, covering up to ten categories: SAST, Secrets, SCA, IaC, Anti-Patterns, Complex Functions, Docstring, Duplicate Code, Dead Code, and SBOM. Each category is emitted as its own labeled section with category-specific columns. By default, issues dismissed via the admin UI's dismiss-alerts workflow and issues flagged as false positives are excluded - use `include_dismissed` / `include_false_positives` to override. Returns a presigned URL for the resulting CSV.",
        "operationId": "getFullReport",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FullReportRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example with default fields",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github",
                    "branch": "main",
                    "fields": [
                      "Static Application Security Testing (SAST)",
                      "Secrets",
                      "Software Composition Analysis (SCA)",
                      "Infrastructure as Code",
                      "Anti-Patterns",
                      "Complex Functions",
                      "Docstring",
                      "Duplicate Code",
                      "Dead Code",
                      "SBOM"
                    ]
                  }
                },
                "githubIncludeDismissed": {
                  "summary": "Include dismissed issues and false positives",
                  "value": {
                    "repo": "owner/repository",
                    "commit_id": "abc123def456",
                    "access_token": "ghp_xxxxxxxxxxxx",
                    "service": "github",
                    "branch": "main",
                    "include_dismissed": true,
                    "include_false_positives": true
                  }
                },
                "azuredevops": {
                  "summary": "Azure DevOps repository example",
                  "value": {
                    "repo": "organization/project/repository",
                    "commit_id": "abc123def456",
                    "access_token": "pat_xxxxxxxxxxxx",
                    "service": "azuredevops",
                    "branch": "develop",
                    "azure_devops_base_url": "https://dev.azure.com"
                  }
                },
                "gitlab": {
                  "summary": "GitLab repository example",
                  "value": {
                    "repo": "group/repository",
                    "commit_id": "abc123def456",
                    "access_token": "glpat_xxxxxxxxxxxx",
                    "service": "gitlab",
                    "branch": "main",
                    "gitlab_base_url": "https://gitlab.com"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket repository example",
                  "value": {
                    "repo": "workspace/repository",
                    "commit_id": "abc123def456",
                    "access_token": "bitbucket_token",
                    "service": "bitbucket",
                    "branch": "main",
                    "bitbucket_base_url": "https://api.bitbucket.org/2.0"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full report generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FullReportResponse"
                },
                "example": {
                  "report_url": "https://storage.example.com/reports/owner-repository-abc123def456.html",
                  "status": "success",
                  "commit_id": "abc123def456",
                  "branch": "main"
                }
              }
            }
          },
          "400": {
            "description": "Missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: repo, commit_id, access_token, service"
                }
              }
            }
          },
          "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 generating full report: Failed to fetch analysis results"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/scan-history": {
      "post": {
        "summary": "Get Scan History",
        "description": "Retrieves the scan history for a repository, returning the last analysis results for each commit that has been scanned",
        "operationId": "getScanHistory",
        "tags": [
          "Analysis"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanHistoryRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub repository example",
                  "value": {
                    "repo": "owner/repository",
                    "platform": "github",
                    "org": "owner",
                    "github_base_url": "https://github.com"
                  }
                },
                "gitlab": {
                  "summary": "GitLab repository example",
                  "value": {
                    "repo": "group/repository",
                    "platform": "gitlab",
                    "org": "group",
                    "gitlab_base_url": "https://gitlab.com"
                  }
                },
                "azuredevops": {
                  "summary": "Azure DevOps repository example",
                  "value": {
                    "repo": "organization/project/repository",
                    "platform": "azuredevops",
                    "org": "organization",
                    "azure_devops_base_url": "https://dev.azure.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scan history retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanHistoryResponse"
                },
                "example": {
                  "repo": "owner/repository",
                  "last_analysis_results": [
                    {
                      "commit_id": "abc123def456",
                      "branch": "main",
                      "timestamp": "2025-01-15T10:30:00Z",
                      "status": "completed"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Missing required parameter: repo"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Access token invalid or does not have access to this organization"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/analysis/findings/dismiss": {
      "post": {
        "summary": "Dismiss Findings",
        "description": "Dismisses one or many findings of a repository in a single call, exactly like the Dismiss action in the dashboard: dismissed findings leave the active lists and the Hotlist and move to the repository's Dismissed tab, where they can be restored. Group findings by repository and scanner and send each group as one request.",
        "operationId": "dismissFindings",
        "tags": [
          "Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DismissFindingsRequest"
              },
              "example": {
                "platform": "github",
                "org": "owner",
                "repo": "owner/repository",
                "analysis_type": "sca",
                "dismiss_keys": [
                  "cross-spawn@7.0.3::package-lock.json::CVE-2024-21538",
                  "lodash@4.17.20"
                ],
                "reason": "This alert is inaccurate or incorrect",
                "comment": "Dev-only dependency, not shipped"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Findings dismissed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "dismissed": {
                      "type": "integer",
                      "description": "Number of dismiss keys written.",
                      "example": 2
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Token lacks Code Security permission for this repository",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/create": {
      "post": {
        "summary": "Create Team",
        "description": "Creates a new developer team. Teams can be organized around **developers** (by adding members), **repositories** (by assigning repos), or **both**. You can also create empty teams and add members/repos later via the update and member endpoints.\n\nUse cases:\n- **Developer-based team**: Pass `members` to group developers (e.g. a frontend squad). You can optionally pass `repositories` as a filter to scope metrics to specific repos for this team.\n- **Repository-based team**: Pass only `repositories` to group repos (e.g. all microservices). No members - metrics are aggregated across the listed repos.\n- **Mixed team**: Pass both `members` and `repositories` - metrics are scoped to these members across these repos.\n- **Disabled lists**: Create special teams named `codeant-disabled-members` or `codeant-disabled-repos` to exclude specific developers or repositories from all metrics calculations across the organization.\n\nOptionally assign one or more `team_leads` (by login) and categorize teams with `tags`. Teams can be nested using `parent_team_id`.",
        "operationId": "createTeam",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTeamRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub - developer-based team",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "name": "Backend Squad",
                    "description": "Backend API developers",
                    "members": [
                      {
                        "user_login": "jane@example.com",
                        "user_name": "Jane Doe",
                        "role": "lead"
                      },
                      {
                        "user_login": "john@example.com",
                        "user_name": "John Smith",
                        "role": "member"
                      }
                    ],
                    "team_leads": [
                      "jane@example.com"
                    ]
                  }
                },
                "gitlab": {
                  "summary": "GitLab - repository-based team",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "name": "Microservices",
                    "description": "All microservice repositories",
                    "repositories": [
                      "my-group/auth-service",
                      "my-group/payment-service",
                      "my-group/user-service"
                    ]
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket - mixed team (members + repos)",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "name": "Platform Team",
                    "description": "Platform engineering team and their repos",
                    "members": [
                      {
                        "user_login": "alice@example.com",
                        "user_name": "Alice",
                        "role": "lead"
                      }
                    ],
                    "repositories": [
                      "my-workspace/infra",
                      "my-workspace/ci-tools"
                    ],
                    "tags": [
                      "platform",
                      "infra"
                    ]
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps - empty team (add members later)",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "name": "New Project Team",
                    "description": "Team for the upcoming project"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Team created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Team created successfully"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/list": {
      "post": {
        "summary": "List Teams",
        "description": "Returns all teams for the given organization. By default only active teams are returned; set `include_inactive: true` to include soft-deleted teams.",
        "operationId": "listTeams",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/DevMetricsBaseRequest"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "include_inactive": {
                        "type": "boolean",
                        "default": false,
                        "description": "Include soft-deleted (inactive) teams"
                      }
                    }
                  }
                ]
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "List of teams",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "teams": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Team"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "description": "Number of teams returned"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/get": {
      "post": {
        "summary": "Get Team",
        "description": "Retrieves a single team by its ID, including full member list and repository assignments.",
        "operationId": "getTeam",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamIdRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Team details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/update": {
      "post": {
        "summary": "Update Team",
        "description": "Updates team metadata such as name, description, color, team leads, tags, or assigned repositories. Only include the fields you want to change - omitted fields are left unchanged.",
        "operationId": "updateTeam",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTeamRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub - rename + update leads",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "name": "Backend Team v2",
                    "description": "Updated description",
                    "team_leads": [
                      "alice",
                      "bob"
                    ]
                  }
                },
                "gitlab": {
                  "summary": "GitLab - change color + repos",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "gitlab_base_url": "https://gitlab.com",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "color": "#EF4444",
                    "repositories": [
                      "my-group/api",
                      "my-group/web"
                    ]
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket - rename",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "bitbucket_base_url": "https://api.bitbucket.org/2.0",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "name": "Backend Team v2"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps - update tags",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "azure_devops_base_url": "https://dev.azure.com",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "tags": [
                      "backend",
                      "infrastructure"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Team updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Team updated successfully"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/delete": {
      "post": {
        "summary": "Delete Team",
        "description": "Deletes a team. By default performs a **soft delete** (marks the team as inactive). Set `hard_delete: true` to permanently remove the team and its data.",
        "operationId": "deleteTeam",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteTeamRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Team deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "success",
                  "message": "Team deleted successfully"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/members/add": {
      "post": {
        "summary": "Add Team Member",
        "description": "Adds a new member to a team. The `user_login` must be unique within the team.",
        "operationId": "addTeamMember",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMemberRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "user_name": "Jane Doe",
                    "role": "member"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "user_name": "Jane Doe",
                    "role": "member"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "user_name": "Jane Doe",
                    "role": "member"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "user_name": "Jane Doe",
                    "role": "member"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Member added",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Member added successfully"
                    },
                    "member": {
                      "$ref": "#/components/schemas/TeamMember"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/members/remove": {
      "post": {
        "summary": "Remove Team Member",
        "description": "Removes a member from a team by their `user_login`.",
        "operationId": "removeTeamMember",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMemberRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Member removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Member removed successfully"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/teams/members/update": {
      "post": {
        "summary": "Update Team Member",
        "description": "Updates a team member's role or display name.",
        "operationId": "updateTeamMember",
        "tags": [
          "Developer Metrics - Teams"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TeamMemberRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "role": "lead"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "role": "lead"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "role": "lead"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "team_id": "15884668-91e2-4def-9d20-b7cf4698117d",
                    "user_login": "jane@example.com",
                    "role": "lead"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Member updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Member updated successfully"
                    },
                    "team": {
                      "$ref": "#/components/schemas/Team"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Team not found"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/comparison/get": {
      "post": {
        "summary": "Get Developer Comparison",
        "description": "Retrieves a developer's productivity metrics compared against the organization average. Includes commit activity, PR statistics, code review contributions, and more. Useful for individual performance dashboards and 1:1 reviews.",
        "operationId": "getDevComparison",
        "tags": [
          "Developer Metrics"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevComparisonRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "author": "janedoe",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "author": "janedoe",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "author": "janedoe",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "author": "janedoe",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Developer comparison data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metric": {
                      "type": "string",
                      "example": "dev_comparison"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "org": {
                      "type": "string"
                    },
                    "author": {
                      "type": "string"
                    },
                    "start_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "end_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "org_context": {
                      "type": "object",
                      "description": "Organization-wide averages and context data"
                    },
                    "developer": {
                      "type": "object",
                      "description": "Individual developer metrics and activity data"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/summary/get": {
      "post": {
        "summary": "Get Developer Summary",
        "description": "Generates an AI-powered natural-language summary of a developer's contributions across the specified repositories and date range. Includes PR descriptions and an overall narrative of work done. If `repositories` is omitted, all repositories under the organization are used.",
        "operationId": "getDevSummary",
        "tags": [
          "Developer Metrics"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DevSummaryRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "author": "janedoe",
                    "repositories": [
                      "my-org/backend-api"
                    ],
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "author": "janedoe",
                    "repositories": [
                      "my-group/backend-api"
                    ],
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "author": "janedoe",
                    "repositories": [
                      "my-workspace/backend-api"
                    ],
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "author": "janedoe",
                    "repositories": [
                      "my-org/backend-api"
                    ],
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Developer summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metric": {
                      "type": "string",
                      "example": "dev_summary"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "org": {
                      "type": "string"
                    },
                    "author": {
                      "type": "string"
                    },
                    "repositories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "start_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "end_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "summary": {
                      "type": "string",
                      "description": "AI-generated natural-language summary of the developer's work"
                    },
                    "pr_descriptions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Descriptions of PRs included in the analysis"
                    },
                    "execution_time": {
                      "type": "number",
                      "description": "Time taken to generate the summary (seconds)"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: author, start_date, end_date"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No repositories found for the organization (when `repositories` is omitted)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "No repositories found for this organization"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/devs/active/get": {
      "post": {
        "summary": "Get Active Developers",
        "description": "Returns all developers who made commits in the organization during the specified date range. Includes per-developer statistics: commit counts, lines added/deleted, language breakdown, coding day distribution, and repository contributions. Useful for team activity dashboards and headcount tracking.",
        "operationId": "getActiveDevs",
        "tags": [
          "Developer Metrics"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DateRangeRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Active developers list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metric": {
                      "type": "string",
                      "example": "active_developers"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "org": {
                      "type": "string"
                    },
                    "start_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "end_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "active_developers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ActiveDeveloper"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "description": "Number of active developers"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics/developer/prs/get": {
      "post": {
        "summary": "Get Developer PR Data",
        "description": "Returns pull request activity for all developers in the organization during the specified date range. Includes open/merged/closed PR counts, code change statistics, and detailed PR listings per developer. Useful for code review dashboards and throughput analysis.",
        "operationId": "getDeveloperPRData",
        "tags": [
          "Developer Metrics"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DateRangeRequest"
              },
              "examples": {
                "github": {
                  "summary": "GitHub",
                  "value": {
                    "platform": "github",
                    "org": "my-org",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "gitlab": {
                  "summary": "GitLab",
                  "value": {
                    "platform": "gitlab",
                    "org": "my-group",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "bitbucket": {
                  "summary": "Bitbucket",
                  "value": {
                    "platform": "bitbucket",
                    "org": "my-workspace",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                },
                "azure_devops": {
                  "summary": "Azure DevOps",
                  "value": {
                    "platform": "azure_devops",
                    "org": "my-org",
                    "start_date": "2025-01-01",
                    "end_date": "2025-03-01"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Developer PR data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metric": {
                      "type": "string",
                      "example": "developer_pr_data"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "org": {
                      "type": "string"
                    },
                    "start_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "end_date": {
                      "type": "string",
                      "format": "date"
                    },
                    "developer_pr_data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeveloperPRData"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "description": "Number of developers with PR activity"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "example": {
                  "error": "Missing required parameters: platform, org"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - missing, invalid, or insufficient access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsErrorResponse"
                },
                "examples": {
                  "missing_token": {
                    "summary": "Missing Authorization header",
                    "value": {
                      "error": "Missing Authorization header. Use 'Bearer <access_token>'"
                    }
                  },
                  "invalid_token": {
                    "summary": "Invalid or insufficient token",
                    "value": {
                      "error": "Access token invalid or does not have access to this organization"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevMetricsStatusResponse"
                },
                "example": {
                  "status": "error",
                  "message": "Internal server error"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/scan/start": {
      "post": {
        "summary": "Start Agent Scan",
        "description": "Initiates an AI-powered agent analysis for a repository. The agent uses LLM-based code exploration to perform deep security threat hunting, bug finding, or custom analysis based on user-provided instructions. Files are filtered by extension, size (≤400KB), and line count (≤5000 lines), with a maximum of 500 files per scan.",
        "operationId": "startAgentScan",
        "tags": [
          "Agent Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentScanStartRequest"
              },
              "examples": {
                "threat_hunting": {
                  "summary": "Threat hunting scan on a GitHub repository",
                  "value": {
                    "service": "github",
                    "repo": "owner/repository",
                    "accessToken": "ghp_xxxxxxxxxxxx",
                    "branch": "main",
                    "instructionPrompt": "threat_hunting",
                    "includeFiles": "src/**/*.py,lib/**/*.js",
                    "excludeFiles": "tests/**,node_modules/**"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent scan successfully started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentScanStartResponse"
                },
                "example": {
                  "message": "Scan started successfully",
                  "scanId": "aB3xK9mP2q",
                  "filesQueued": 142
                }
              }
            }
          },
          "400": {
            "description": "Missing required parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Missing required parameter: instructionPrompt"
                }
              }
            }
          },
          "500": {
            "description": "Failed to start scan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Failed to start scan"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/scan/results": {
      "post": {
        "summary": "Get Agent Scan Results",
        "description": "Retrieves the results of an agent analysis scan. If the scan is still in progress, returns a status of `in_progress`. Once complete, returns deduplicated issues found across all analyzed files. Issues are deduplicated using LLM-based analysis to remove duplicate findings across files.",
        "operationId": "getAgentScanResults",
        "tags": [
          "Agent Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentScanResultsRequest"
              },
              "example": {
                "repo": "owner/repository",
                "scanId": "aB3xK9mP2q"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scan results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentScanResultsResponse"
                },
                "examples": {
                  "completed": {
                    "summary": "Completed scan with results",
                    "value": {
                      "scanId": "aB3xK9mP2q",
                      "repoName": "owner/repository",
                      "status": "completed",
                      "results": [
                        {
                          "file": "src/auth/login.py",
                          "scan_id": "aB3xK9mP2q",
                          "issues": [
                            {
                              "relevant_file": "src/auth/login.py",
                              "language": "python",
                              "suggestion_content": "The `authenticate` function does not validate the length of the password parameter before passing it to the bcrypt hashing function. Extremely long passwords (>72 bytes) are silently truncated by bcrypt, which could lead to collision vulnerabilities.",
                              "start_line": 45,
                              "end_line": 52,
                              "one_sentence_summary": "Password length not validated before bcrypt hashing",
                              "label": "Security",
                              "severity": "medium",
                              "cwe_id": "CWE-916",
                              "agent_instructions": "threat_hunting"
                            }
                          ]
                        }
                      ],
                      "totalIssues": 1
                    }
                  },
                  "in_progress": {
                    "summary": "Scan still in progress",
                    "value": {
                      "scanId": "aB3xK9mP2q",
                      "repoName": "owner/repository",
                      "status": "in_progress",
                      "results": [],
                      "totalIssues": 0
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Scan not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Scan not found"
                }
              }
            }
          },
          "500": {
            "description": "Failed to retrieve scan results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Failed to retrieve scan results"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/scan/history": {
      "post": {
        "summary": "Get Agent Scan History",
        "description": "Retrieves the history of all agent analysis scans for a repository, sorted by most recent first. Each entry includes metadata about the scan such as the branch, commit, prompt used, and number of files analyzed.",
        "operationId": "getAgentScanHistory",
        "tags": [
          "Agent Analysis"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentScanHistoryRequest"
              },
              "example": {
                "repo": "owner/repository"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scan history retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentScanHistoryResponse"
                },
                "example": {
                  "scans": [
                    {
                      "service": "github",
                      "repo_name": "owner/repository",
                      "branch": "main",
                      "commit_id": "abc123def456",
                      "scan_id": "aB3xK9mP2q",
                      "prompt": "threat_hunting",
                      "timestamp": "2025-03-15T10:30:00Z",
                      "num_files": 142
                    },
                    {
                      "service": "github",
                      "repo_name": "owner/repository",
                      "branch": "develop",
                      "commit_id": "def456ghi789",
                      "scan_id": "zY8wV7uT6s",
                      "prompt": "bug_finding",
                      "timestamp": "2025-03-14T08:15:00Z",
                      "num_files": 98
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid repo parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Missing or invalid repo parameter"
                }
              }
            }
          },
          "500": {
            "description": "Failed to retrieve scan history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Failed to retrieve scan history"
                }
              }
            }
          }
        }
      }
    },
    "/api/audit/events": {
      "post": {
        "summary": "List Audit Events",
        "description": "Retrieves your organization's audit events oldest-first with cursor pagination. Designed for incremental ingestion: pass `since` (or the previous `next_cursor`) on each run to fetch only new events. Authenticate with a CodeAnt API token (requires the `settings_organization: read` permission when token scoping is configured). Every call to this endpoint is itself recorded in the audit log as `audit_log.api_read`.",
        "operationId": "listAuditEvents",
        "tags": [
          "Audit Logs"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditEventsRequest"
              },
              "examples": {
                "basic": {
                  "summary": "Last 7 days (default range)",
                  "value": {
                    "platform": "github",
                    "org": "Example-Org"
                  }
                },
                "incremental": {
                  "summary": "Incremental ETL pull since a timestamp",
                  "value": {
                    "platform": "github",
                    "org": "Example-Org",
                    "since": "2026-07-30T00:00:00Z",
                    "limit": 1000
                  }
                },
                "ndjson": {
                  "summary": "NDJSON file for a custom range",
                  "value": {
                    "platform": "gitlab",
                    "org": "example-group",
                    "start_date": "2026-07-01",
                    "end_date": "2026-07-31",
                    "format": "ndjson"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audit events retrieved successfully. With `format: ndjson` or `csv` the body is the raw file instead, and paging moves to the `X-Next-Cursor` and `X-Has-More` response headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventsResponse"
                },
                "example": {
                  "org": "Example-Org",
                  "service": "github",
                  "base_url_domain": "github.com",
                  "start_date": "2026-07-24",
                  "end_date": "2026-07-31",
                  "retention_days": 180,
                  "count": 2,
                  "has_more": false,
                  "next_cursor": "Y29kZWFudC1hdWRpdC1sb2dzLzIwMjYtMDctMzAvLi4u",
                  "events": [
                    {
                      "event_id": "a3f9c2e1b4d84f7a9c0e5d6b7a8f9012",
                      "timestamp": "2026-07-30T09:14:03.512345Z",
                      "action": "rbac.role_update",
                      "description": "Access control: role update",
                      "actor_type": "user",
                      "actor_id": "harshit-dubey",
                      "actor_email": "admin@example.com",
                      "org": "Example-Org",
                      "service": "github",
                      "base_url_domain": "github.com",
                      "source": "ui",
                      "target_type": "rbac",
                      "target_id": "role_7d2f",
                      "target_name": "Security Reviewer",
                      "outcome": "success",
                      "status_code": 200,
                      "method": "POST",
                      "path": "/settings/rbac/roles/update",
                      "ip": "203.0.113.42",
                      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
                      "request_id": "req_01J1ZX2Y3A4B5C6D",
                      "changes": {
                        "permissions": {
                          "before": "read",
                          "after": "write"
                        }
                      },
                      "details": {
                        "role_name": "Security Reviewer"
                      }
                    },
                    {
                      "event_id": "c1a2b3d4e5f60718293a4b5c6d7e8f90",
                      "timestamp": "2026-07-30T10:00:00.000000Z",
                      "action": "analysis.scan_trigger",
                      "description": "Analysis: scan trigger",
                      "actor_type": "system",
                      "actor_id": "codeant-internal-queue",
                      "actor_email": null,
                      "org": "Example-Org",
                      "service": "github",
                      "base_url_domain": "github.com",
                      "source": "scheduled_job",
                      "target_type": "analysis",
                      "target_id": null,
                      "target_name": "example-org/payments-api",
                      "outcome": "success",
                      "status_code": 200,
                      "method": "POST",
                      "path": "/doAnalysis",
                      "ip": "10.0.4.18",
                      "user_agent": "python-requests/2.32.0",
                      "request_id": "req_01J1ZXB2C3D4E5F6",
                      "changes": null,
                      "details": {
                        "reponame": "example-org/payments-api",
                        "branch": "main"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters (e.g. malformed `since` timestamp)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Invalid `since` — use an ISO 8601 timestamp"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Access token invalid or does not have access to this organization"
                }
              }
            }
          }
        }
      }
    },
    "/api/cloud/container-scanning/containers": {
      "post": {
        "summary": "List Scanned Containers",
        "description": "Returns one entry per tracked container (registry repository / image) across AWS ECR, Azure ACR, and GCP GAR, each with its latest scan's status, severity rollup, and `scan_id`. Use the returned `cloud` and `scan_id` with the results endpoint to fetch the full vulnerability list.",
        "operationId": "listScannedContainers",
        "tags": [
          "Container Scanning"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerScanContextRequest"
              },
              "example": {
                "platform": "github",
                "org": "Example-Org"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Containers retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "containers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Container"
                      }
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/cloud/container-scanning/results": {
      "post": {
        "summary": "Get Container Scan Vulnerabilities",
        "description": "Returns the vulnerability findings of a container scan — the list displayed in the CodeAnt UI — including CVE id, affected package, installed/fixed versions, severity, EPSS enrichment, and public-exploit references. While the scan is still running the response carries its status without findings.",
        "operationId": "getContainerScanVulnerabilities",
        "tags": [
          "Container Scanning"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContainerScanResultsRequest"
              },
              "example": {
                "platform": "github",
                "org": "Example-Org",
                "cloud": "aws",
                "scan_id": "aB3xK9mP2q"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scan results retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scan_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "completed"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "completed_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "repositories": {
                      "type": "array",
                      "description": "Per-repository scan summaries with severity rollups",
                      "items": {
                        "type": "object"
                      }
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ContainerFinding"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Scan not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "scan not found"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/security/hotlist/findings": {
      "post": {
        "summary": "List Hotlist Findings",
        "description": "Returns the organization's ranked security Hotlist — the same prioritized list shown on the CodeAnt Hotlist page. Every SCA, SAST, secrets, IaC, cloud (CSPM) and AI-exploitation finding across the organization is deduplicated and scored on severity, EPSS/CVSS, CISA KEV membership, confirmed exploitability, dependency reachability, secret validation and production context, then returned highest priority first alongside `summary` rollups, `facets` for filter discovery, and cursor pagination. Ticket, assignee and SLA state is synced live from the linked Jira, Linear, GitHub, Azure DevOps or GitLab issue.\n\nThe Hotlist is served from a materialized snapshot: the first call after a rebuild returns `202` while it is built — retry after `retry_after_seconds`.",
        "operationId": "listHotlistFindings",
        "tags": [
          "Security Hotlist"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HotlistFindingsRequest"
              },
              "example": {
                "platform": "github",
                "org": "Example-Org",
                "filters": {
                  "severities": [
                    "critical",
                    "high"
                  ],
                  "types": [
                    "SCA",
                    "Secrets"
                  ]
                },
                "limit": 50
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked findings returned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "type": "string",
                      "example": "ready"
                    },
                    "snapshot_revision": {
                      "type": "string",
                      "description": "Revision of the snapshot this page was served from."
                    },
                    "scoring_version": {
                      "type": "string",
                      "example": "hotlist-v2"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source_freshness": {
                      "type": "object",
                      "description": "Last time each scanner's data was folded into the snapshot."
                    },
                    "summary": {
                      "$ref": "#/components/schemas/HotlistSummary"
                    },
                    "facets": {
                      "type": "object",
                      "description": "Available filter values with their counts, keyed by the dimensions of `HotlistFilters`."
                    },
                    "sla_config": {
                      "type": "object",
                      "description": "SLA in days configured per severity; `null` means no SLA for that severity."
                    },
                    "total_filtered": {
                      "type": "integer",
                      "description": "Findings matching the request across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "One page of findings, highest priority first.",
                      "items": {
                        "$ref": "#/components/schemas/HotlistFinding"
                      }
                    },
                    "next_cursor": {
                      "type": "string",
                      "nullable": true,
                      "description": "Pass back as `cursor` to fetch the next page; `null` on the last page."
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "The Hotlist snapshot is still building; retry shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HotlistBuildingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter, limit or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HotlistErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The cursor no longer matches the snapshot or the filters it was issued for; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HotlistErrorResponse"
                },
                "example": {
                  "error": {
                    "code": "HOTLIST_CURSOR_STALE",
                    "message": "The Hotlist changed; restart pagination."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/security/hotlist/export": {
      "post": {
        "summary": "Export Hotlist to Excel",
        "description": "Renders every finding matching `filters` and `search` — ranked exactly as the findings endpoint returns them — into an Excel (.xlsx) workbook, and returns a presigned download link valid for five minutes. The workbook is a single `Hotlist` sheet with a frozen, auto-filtered header row covering rank, finding, identifier, type, severity, location, priority score and signals, exploit / KEV / fixable flags, ticket status, provider, assignee, provider status, SLA due date and status, ticket URL, file path, line and compliance frameworks.\n\nUnlike the findings endpoint this is not paginated — the export always holds the complete filtered list. Omit `filters` and `search` to export the entire Hotlist.",
        "operationId": "exportHotlistExcel",
        "tags": [
          "Security Hotlist"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HotlistExportRequest"
              },
              "example": {
                "platform": "github",
                "org": "Example-Org",
                "filters": {
                  "severities": [
                    "critical"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Workbook generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "download_url": {
                      "type": "string",
                      "description": "Presigned link to the .xlsx workbook. It needs no authentication and expires after `expires_in` seconds."
                    },
                    "expires_in": {
                      "type": "integer",
                      "description": "Lifetime of `download_url`, in seconds.",
                      "example": 300
                    },
                    "filename": {
                      "type": "string",
                      "example": "Hotlist_Example-Org_20260829T101500Z.xlsx"
                    },
                    "size_bytes": {
                      "type": "integer"
                    },
                    "finding_count": {
                      "type": "integer",
                      "description": "Rows written to the workbook."
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "The Hotlist snapshot is still building; retry shortly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HotlistBuildingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter or search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid access token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AnalysisStartRequest": {
        "type": "object",
        "required": [
          "repo",
          "commit_id",
          "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",
            "example": "abc123def456"
          },
          "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"
          },
          "branch": {
            "type": "string",
            "description": "Git branch name",
            "example": "main"
          },
          "include_files": {
            "type": "string",
            "description": "Comma-separated file patterns to include in analysis",
            "example": "src/**/*.py,lib/**/*.js,app/**/*.ts"
          },
          "exclude_files": {
            "type": "string",
            "description": "Comma-separated file patterns to exclude from analysis",
            "example": "tests/**,node_modules/**,dist/**"
          },
          "scan_types": {
            "type": "array",
            "description": "Subset of scanners to run. Omit (or send an empty list) to run the full analysis. Scanners left out report `status: done` with empty results for that commit.",
            "items": {
              "type": "string",
              "enum": [
                "sast",
                "sca",
                "secrets",
                "iac",
                "sbom",
                "duplicate_code",
                "docstring",
                "antipatterns",
                "dead_code"
              ]
            },
            "example": [
              "sca"
            ]
          }
        }
      },
      "AnalysisResultsRequest": {
        "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"
          }
        }
      },
      "SBOMRequest": {
        "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"
          }
        }
      },
      "SecretsRequest": {
        "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"
          }
        }
      },
      "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"
          }
        }
      },
      "IaCRequest": {
        "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"
          }
        }
      },
      "ScanHistoryRequest": {
        "type": "object",
        "required": [
          "repo",
          "platform",
          "org"
        ],
        "properties": {
          "repo": {
            "type": "string",
            "description": "Repository identifier (format varies by platform)",
            "example": "owner/repository"
          },
          "platform": {
            "type": "string",
            "description": "Version control platform",
            "enum": [
              "github",
              "azuredevops",
              "gitlab",
              "bitbucket"
            ],
            "example": "github"
          },
          "org": {
            "type": "string",
            "description": "Organization or workspace name",
            "example": "owner"
          },
          "github_base_url": {
            "type": "string",
            "description": "GitHub base URL (for self-hosted instances)",
            "default": "https://github.com"
          },
          "gitlab_base_url": {
            "type": "string",
            "description": "GitLab base URL (for self-hosted instances)",
            "default": "https://gitlab.com"
          },
          "azure_devops_base_url": {
            "type": "string",
            "description": "Azure DevOps base URL",
            "default": "https://dev.azure.com"
          },
          "bitbucket_base_url": {
            "type": "string",
            "description": "Bitbucket base URL (for self-hosted instances)",
            "default": "https://api.bitbucket.org/2.0"
          }
        }
      },
      "ScanHistoryResponse": {
        "type": "object",
        "properties": {
          "repo": {
            "type": "string",
            "description": "Repository identifier"
          },
          "last_analysis_results": {
            "type": "array",
            "description": "List of last analysis results for each scanned commit",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Success message"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message"
          }
        }
      },
      "AnalysisResults": {
        "type": "object",
        "description": "Analysis results containing security issues and summary",
        "properties": {
          "security_issues": {
            "type": "array",
            "description": "List of security issues found",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Type of security issue"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "critical",
                    "high",
                    "medium",
                    "low",
                    "info"
                  ],
                  "description": "Severity level of the issue"
                },
                "file": {
                  "type": "string",
                  "description": "File path where issue was found"
                },
                "line": {
                  "type": "integer",
                  "description": "Line number where issue was found"
                },
                "description": {
                  "type": "string",
                  "description": "Detailed description of the issue"
                }
              }
            }
          },
          "summary": {
            "type": "object",
            "description": "Summary statistics of the analysis",
            "properties": {
              "total_issues": {
                "type": "integer",
                "description": "Total number of issues found"
              },
              "critical_severity": {
                "type": "integer",
                "description": "Number of critical severity issues"
              },
              "high_severity": {
                "type": "integer",
                "description": "Number of high severity issues"
              },
              "medium_severity": {
                "type": "integer",
                "description": "Number of medium severity issues"
              },
              "low_severity": {
                "type": "integer",
                "description": "Number of low severity issues"
              },
              "info_severity": {
                "type": "integer",
                "description": "Number of informational issues"
              }
            }
          }
        }
      },
      "SBOMResponse": {
        "type": "object",
        "description": "Software Bill of Materials (SBOM) response containing package and license information",
        "properties": {
          "results": {
            "type": "object",
            "description": "SBOM analysis results",
            "properties": {
              "rootFolder": {
                "type": "string",
                "description": "Root folder path where the analysis was performed",
                "example": "/mnt/lambda/owner/repository/abc123def456"
              },
              "timestamp": {
                "type": "string",
                "nullable": true,
                "description": "Timestamp of the analysis",
                "example": null
              },
              "sboms": {
                "type": "array",
                "description": "List of SBOM entries for different languages",
                "items": {
                  "type": "object",
                  "properties": {
                    "language": {
                      "type": "string",
                      "description": "Programming language of the packages",
                      "example": "Python"
                    },
                    "sourceFile": {
                      "type": "string",
                      "description": "Source file containing package information",
                      "example": "/tmp/superRequirements.txt"
                    },
                    "packages": {
                      "type": "array",
                      "description": "List of packages found in the source file",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Package name",
                            "example": "@alloc/quick-lru"
                          },
                          "version": {
                            "type": "string",
                            "description": "Package version or hash",
                            "example": "5.2.0"
                          },
                          "licenseDeclared": {
                            "type": "string",
                            "description": "Declared license for the package",
                            "example": "MIT"
                          },
                          "licenseConcluded": {
                            "type": "string",
                            "description": "Concluded license after analysis",
                            "example": "MIT"
                          },
                          "licenseReason": {
                            "type": "string",
                            "description": "Reason for license determination",
                            "example": "NOASSERTION"
                          },
                          "licenseStandard": {
                            "type": "boolean",
                            "description": "Whether the license is a standard license",
                            "example": true
                          },
                          "copyleftStrength": {
                            "type": "string",
                            "description": "Copyleft strength classification",
                            "enum": [
                              "permissive",
                              "weak",
                              "strong",
                              "proprietary_or_unknown"
                            ],
                            "example": "permissive"
                          },
                          "policyLevel": {
                            "type": "string",
                            "description": "Policy compliance level",
                            "enum": [
                              "allow",
                              "review",
                              "deny"
                            ],
                            "example": "allow"
                          },
                          "policyNote": {
                            "type": "string",
                            "description": "Notes about policy requirements",
                            "example": "Permissive license: keep license and notices"
                          },
                          "spdxId": {
                            "type": "string",
                            "nullable": true,
                            "description": "SPDX identifier for the license",
                            "example": "MIT"
                          },
                          "badTerms": {
                            "type": "array",
                            "description": "List of concerning license terms",
                            "items": {
                              "type": "object",
                              "properties": {
                                "tag": {
                                  "type": "string",
                                  "description": "Tag identifying the concerning term",
                                  "example": "modifications_must_be_public"
                                },
                                "start": {
                                  "type": "integer",
                                  "description": "Start position of the term in license text",
                                  "example": 246
                                },
                                "end": {
                                  "type": "integer",
                                  "description": "End position of the term in license text",
                                  "example": 268
                                },
                                "evidence": {
                                  "type": "string",
                                  "description": "Excerpt of the concerning text",
                                  "example": "out limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell co"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "packagesCount": {
                      "type": "integer",
                      "description": "Total number of packages found",
                      "example": 1
                    }
                  }
                }
              }
            }
          },
          "status": {
            "type": "string",
            "description": "Status of the SBOM analysis",
            "enum": [
              "pending",
              "processing",
              "done",
              "failed"
            ],
            "example": "done"
          },
          "commit_id": {
            "type": "string",
            "description": "Git commit SHA that was analyzed",
            "example": "abc123def456"
          }
        }
      },
      "SecretsResponse": {
        "type": "object",
        "description": "Secrets scanning response containing detected secrets and sensitive information",
        "properties": {
          "results": {
            "type": "object",
            "description": "Secrets scanning results",
            "properties": {
              "secrets": {
                "type": "array",
                "description": "List of secrets detected",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "Type of secret detected",
                      "example": "Secret Keyword"
                    },
                    "filename": {
                      "type": "string",
                      "description": "Full file path where secret was found",
                      "example": "/mnt/lambda/owner/repository/abc123def456/src/config.py"
                    },
                    "hashed_secret": {
                      "type": "string",
                      "description": "SHA-1 hash of the detected secret",
                      "example": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684"
                    },
                    "is_verified": {
                      "type": "boolean",
                      "description": "Whether the secret has been verified",
                      "example": false
                    },
                    "line_number": {
                      "type": "integer",
                      "description": "Line number where secret was found",
                      "example": 14
                    },
                    "confidence_score": {
                      "type": "string",
                      "description": "Confidence level of the detection",
                      "enum": [
                        "TRUE_POSITIVE",
                        "FALSE_POSITIVE",
                        "UNKNOWN"
                      ],
                      "example": "FALSE_POSITIVE"
                    }
                  }
                }
              },
              "secretsCount": {
                "type": "integer",
                "description": "Total number of secrets found",
                "example": 1
              }
            }
          },
          "status": {
            "type": "string",
            "description": "Status of the secrets scan",
            "enum": [
              "pending",
              "processing",
              "done",
              "failed"
            ],
            "example": "done"
          },
          "commit_id": {
            "type": "string",
            "description": "Git commit SHA that was analyzed",
            "example": "abc123def456"
          }
        }
      },
      "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):\n    headers = {\"Authorization\": f\"Bearer {token}\"}\n    # TODO: Implement timeout for requests\n    response = requests.get(url, headers=headers)\n    if response.status_code == 200:\n        return response.json()\n    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):\n    headers = {\"Authorization\": f\"Bearer {token}\"}\n    # TODO: Implement timeout for requests\n    response = requests.get(url, headers=headers)\n    if response.status_code == 200:\n        return response.json()\n    return None"
                }
              ]
            }
          }
        }
      },
      "IaCResponse": {
        "type": "object",
        "description": "Infrastructure as Code (IaC) scanning response containing security check results",
        "properties": {
          "results": {
            "type": "array",
            "description": "List of IaC scan results by check type",
            "items": {
              "type": "object",
              "properties": {
                "check_type": {
                  "type": "string",
                  "description": "Type of IaC framework checked",
                  "example": "terraform"
                },
                "results": {
                  "type": "object",
                  "description": "Check results for this framework",
                  "properties": {
                    "failed_checks": {
                      "type": "array",
                      "description": "List of failed security checks",
                      "items": {
                        "type": "object",
                        "properties": {
                          "bc_check_id": {
                            "type": "string",
                            "description": "Bridgecrew check identifier",
                            "example": "BC_AWS_NETWORKING_31"
                          },
                          "check_id": {
                            "type": "string",
                            "description": "Checkov check identifier",
                            "example": "CKV_AWS_23"
                          },
                          "check_name": {
                            "type": "string",
                            "description": "Human-readable name of the security check",
                            "example": "Ensure every security group and rule has a description"
                          },
                          "file_path": {
                            "type": "string",
                            "description": "Path to the file with the issue",
                            "example": "/owner/repository/abc123def456/terraform/main.tf"
                          },
                          "file_line_range": {
                            "type": "array",
                            "description": "Line range where the issue occurs",
                            "items": {
                              "type": "integer"
                            },
                            "example": [
                              2,
                              25
                            ]
                          },
                          "check_class": {
                            "type": "string",
                            "description": "Full class path of the check",
                            "example": "checkov.terraform.checks.resource.aws.SecurityGroupRuleDescription"
                          },
                          "code_block": {
                            "type": "array",
                            "description": "Code lines with line numbers",
                            "items": {
                              "type": "array",
                              "description": "Array containing line number and line content",
                              "minItems": 2,
                              "maxItems": 2
                            },
                            "example": [
                              [
                                2,
                                "resource \"aws_security_group\" \"web\" {\n"
                              ],
                              [
                                3,
                                "  name_prefix = \"web-sg\"\n"
                              ]
                            ]
                          },
                          "resource": {
                            "type": "string",
                            "description": "Resource identifier in IaC file",
                            "example": "aws_security_group.web"
                          },
                          "start_line": {
                            "type": "integer",
                            "description": "Starting line number",
                            "example": 2
                          },
                          "end_line": {
                            "type": "integer",
                            "description": "Ending line number",
                            "example": 25
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "FullReportRequest": {
        "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"
          },
          "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"
          },
          "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"
          },
          "fields": {
            "type": "array",
            "description": "List of analysis categories to include in the sectioned CSV report. Each category becomes its own section with category-specific columns.",
            "items": {
              "type": "string",
              "enum": [
                "Static Application Security Testing (SAST)",
                "Secrets",
                "Software Composition Analysis (SCA)",
                "Infrastructure as Code",
                "Anti-Patterns",
                "Complex Functions",
                "Docstring",
                "Duplicate Code",
                "Dead Code",
                "SBOM"
              ]
            },
            "default": [
              "Static Application Security Testing (SAST)",
              "Secrets",
              "Software Composition Analysis (SCA)",
              "Infrastructure as Code",
              "Anti-Patterns",
              "Complex Functions",
              "Docstring",
              "Duplicate Code",
              "Dead Code",
              "SBOM"
            ],
            "example": [
              "Static Application Security Testing (SAST)",
              "Secrets",
              "Software Composition Analysis (SCA)",
              "Infrastructure as Code",
              "Anti-Patterns",
              "Complex Functions",
              "Docstring",
              "Duplicate Code",
              "Dead Code",
              "SBOM"
            ]
          },
          "include_dismissed": {
            "type": "boolean",
            "description": "When true, dismissed issues (those marked as dismissed via the admin UI's dismiss-alerts workflow) are included in the report. Defaults to false, matching the admin UI behavior where dismissed issues are hidden.",
            "default": false,
            "example": false
          },
          "include_false_positives": {
            "type": "boolean",
            "description": "When true, issues flagged as false positives are included - specifically SAST issues with false_positive=true and Secrets with confidence_score=FALSE_POSITIVE. Defaults to false.",
            "default": false,
            "example": false
          },
          "gitlab_base_url": {
            "type": "string",
            "description": "Base URL for GitLab service (optional)",
            "default": "https://gitlab.com",
            "example": "https://gitlab.com"
          },
          "github_base_url": {
            "type": "string",
            "description": "Base URL for GitHub service (optional)",
            "default": "https://github.com",
            "example": "https://github.com"
          },
          "azure_devops_base_url": {
            "type": "string",
            "description": "Base URL for Azure DevOps service (optional)",
            "default": "https://dev.azure.com",
            "example": "https://dev.azure.com"
          },
          "bitbucket_base_url": {
            "type": "string",
            "description": "Base URL for Bitbucket service (optional)",
            "default": "https://api.bitbucket.org/2.0",
            "example": "https://api.bitbucket.org/2.0"
          }
        }
      },
      "FullReportResponse": {
        "type": "object",
        "description": "Full analysis report response containing the report URL and status",
        "properties": {
          "report_url": {
            "type": "string",
            "description": "URL to access the generated HTML report",
            "example": "https://storage.example.com/reports/owner-repository-abc123def456.html"
          },
          "status": {
            "type": "string",
            "description": "Status of the report generation",
            "enum": [
              "success",
              "failed"
            ],
            "example": "success"
          },
          "commit_id": {
            "type": "string",
            "description": "Git commit SHA that was analyzed",
            "example": "abc123def456"
          },
          "branch": {
            "type": "string",
            "description": "Git branch name that was analyzed",
            "example": "main"
          }
        }
      },
      "DevMetricsErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message"
          }
        }
      },
      "DevMetricsStatusResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable status message"
          }
        }
      },
      "DevMetricsBaseRequest": {
        "type": "object",
        "required": [
          "platform",
          "org"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "description": "Version control platform",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops",
              "azuredevops"
            ],
            "example": "github"
          },
          "org": {
            "type": "string",
            "description": "Organization, workspace, or group name on the platform",
            "example": "my-org"
          },
          "github_base_url": {
            "type": "string",
            "description": "Base URL for GitHub (use for GitHub Enterprise Server)",
            "default": "https://github.com",
            "example": "https://github.com"
          },
          "gitlab_base_url": {
            "type": "string",
            "description": "Base URL for GitLab (use for self-hosted GitLab instances)",
            "default": "https://gitlab.com",
            "example": "https://gitlab.com"
          },
          "azure_devops_base_url": {
            "type": "string",
            "description": "Base URL for Azure DevOps (use for Azure DevOps Server)",
            "default": "https://dev.azure.com",
            "example": "https://dev.azure.com"
          },
          "bitbucket_base_url": {
            "type": "string",
            "description": "Base URL for Bitbucket (use for Bitbucket Data Center/Server)",
            "default": "https://api.bitbucket.org/2.0",
            "example": "https://api.bitbucket.org/2.0"
          }
        }
      },
      "TeamMember": {
        "type": "object",
        "description": "A member of a team",
        "properties": {
          "user_login": {
            "type": "string",
            "description": "Unique login/email identifier of the member",
            "example": "jane@example.com"
          },
          "user_name": {
            "type": "string",
            "description": "Display name of the member",
            "example": "Jane Doe"
          },
          "joined_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the member joined the team"
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "lead"
            ],
            "description": "Role within the team",
            "example": "member"
          }
        }
      },
      "Team": {
        "type": "object",
        "description": "A developer team with members, metadata, and repository assignments",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique team identifier"
          },
          "name": {
            "type": "string",
            "description": "Team name",
            "example": "Backend Team"
          },
          "description": {
            "type": "string",
            "description": "Team description",
            "example": "Responsible for API services"
          },
          "color": {
            "type": "string",
            "description": "Hex color for UI display",
            "example": "#1570EF"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_by": {
            "type": "string"
          },
          "team_leads": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of team lead identifiers"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamMember"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "parent_team_id": {
            "type": "string",
            "description": "Parent team ID for nested teams"
          },
          "repositories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Assigned repository names",
            "example": [
              "my-org/backend-api"
            ]
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the team is active"
          }
        }
      },
      "CreateTeamRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 2,
                "description": "Team name (min 2 characters)",
                "example": "Backend Team"
              },
              "description": {
                "type": "string",
                "description": "Team description",
                "example": "Responsible for API services"
              },
              "color": {
                "type": "string",
                "description": "Hex color code",
                "example": "#1570EF"
              },
              "team_leads": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "lead@example.com"
                ]
              },
              "repositories": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "my-org/backend-api"
                ]
              },
              "members": {
                "type": "array",
                "description": "Initial team members to add at creation. You can create a team with members, repositories, or both.",
                "items": {
                  "type": "object",
                  "required": [
                    "user_login"
                  ],
                  "properties": {
                    "user_login": {
                      "type": "string",
                      "description": "Unique login or email of the developer",
                      "example": "jane@example.com"
                    },
                    "user_name": {
                      "type": "string",
                      "description": "Display name (defaults to user_login if omitted)",
                      "example": "Jane Doe"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "member",
                        "lead"
                      ],
                      "default": "member",
                      "description": "Role within the team"
                    }
                  }
                },
                "example": [
                  {
                    "user_login": "jane@example.com",
                    "user_name": "Jane Doe",
                    "role": "lead"
                  },
                  {
                    "user_login": "john@example.com",
                    "user_name": "John Smith",
                    "role": "member"
                  }
                ]
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Tags for categorizing the team",
                "example": [
                  "backend",
                  "api"
                ]
              },
              "parent_team_id": {
                "type": "string",
                "format": "uuid",
                "description": "Parent team ID for creating nested/sub-teams",
                "example": ""
              },
              "created_by": {
                "type": "string",
                "description": "Identifier of who created the team",
                "default": "system",
                "example": "admin@example.com"
              }
            }
          }
        ]
      },
      "UpdateTeamRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "team_id"
            ],
            "properties": {
              "team_id": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the team to update"
              },
              "name": {
                "type": "string",
                "minLength": 2,
                "description": "New team name"
              },
              "description": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "team_leads": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Array of team lead logins/emails. Replaces the entire list when provided.",
                "example": [
                  "lead1@example.com",
                  "lead2@example.com"
                ]
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "repositories": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ]
      },
      "TeamIdRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "team_id"
            ],
            "properties": {
              "team_id": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the team"
              }
            }
          }
        ]
      },
      "DeleteTeamRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "team_id"
            ],
            "properties": {
              "team_id": {
                "type": "string",
                "format": "uuid",
                "description": "ID of the team to delete"
              },
              "hard_delete": {
                "type": "boolean",
                "default": false,
                "description": "If true, permanently removes the team. If false (default), soft-deletes by marking inactive."
              }
            }
          }
        ]
      },
      "TeamMemberRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "team_id",
              "user_login"
            ],
            "properties": {
              "team_id": {
                "type": "string",
                "format": "uuid"
              },
              "user_login": {
                "type": "string",
                "description": "Login/email of the member",
                "example": "jane@example.com"
              },
              "user_name": {
                "type": "string",
                "description": "Display name (for add/update)",
                "example": "Jane Doe"
              },
              "role": {
                "type": "string",
                "enum": [
                  "member",
                  "lead"
                ],
                "default": "member",
                "description": "Member role (for add/update)"
              }
            }
          }
        ]
      },
      "DateRangeRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DevMetricsBaseRequest"
          },
          {
            "type": "object",
            "required": [
              "start_date",
              "end_date"
            ],
            "properties": {
              "start_date": {
                "type": "string",
                "format": "date",
                "description": "Start of the date range (YYYY-MM-DD)",
                "example": "2025-01-01"
              },
              "end_date": {
                "type": "string",
                "format": "date",
                "description": "End of the date range (YYYY-MM-DD)",
                "example": "2025-03-01"
              }
            }
          }
        ]
      },
      "DevComparisonRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DateRangeRequest"
          },
          {
            "type": "object",
            "required": [
              "author"
            ],
            "properties": {
              "author": {
                "type": "string",
                "description": "Git author login/email to analyze",
                "example": "janedoe"
              }
            }
          }
        ]
      },
      "DevSummaryRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DateRangeRequest"
          },
          {
            "type": "object",
            "required": [
              "author"
            ],
            "properties": {
              "author": {
                "type": "string",
                "description": "Git author login/email to analyze",
                "example": "janedoe"
              },
              "repositories": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "List of repository names to scope the summary. If omitted, all repositories under the organization are used.",
                "example": [
                  "my-org/backend-api"
                ]
              }
            }
          }
        ]
      },
      "ActiveDeveloper": {
        "type": "object",
        "description": "An active developer with commit activity and code statistics",
        "properties": {
          "login": {
            "type": "string",
            "description": "Developer's git login/email"
          },
          "name": {
            "type": "string",
            "description": "Developer's display name"
          },
          "commit_count": {
            "type": "integer",
            "description": "Total commits in the date range"
          },
          "repositories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Repositories the developer contributed to"
          },
          "repository_commits": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Commit count per repository"
          },
          "coding_days": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Commits per day (date → count)"
          },
          "total_additions": {
            "type": "integer"
          },
          "total_deletions": {
            "type": "integer"
          },
          "total_files_changed": {
            "type": "integer"
          },
          "languages": {
            "type": "object",
            "description": "Breakdown by file extension",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "additions": {
                  "type": "integer"
                },
                "deletions": {
                  "type": "integer"
                },
                "files": {
                  "type": "integer"
                }
              }
            }
          },
          "commit_times": {
            "type": "object",
            "description": "Commits by time of day",
            "properties": {
              "morning": {
                "type": "integer"
              },
              "afternoon": {
                "type": "integer"
              },
              "evening": {
                "type": "integer"
              },
              "night": {
                "type": "integer"
              }
            }
          },
          "repository_count": {
            "type": "integer"
          },
          "avg_commit_size": {
            "type": "number"
          },
          "net_code_impact": {
            "type": "integer",
            "description": "additions - deletions"
          },
          "test_ratio": {
            "type": "number",
            "description": "Ratio of test code changes"
          }
        }
      },
      "DeveloperPRData": {
        "type": "object",
        "description": "A developer's pull request activity and statistics",
        "properties": {
          "login": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "total_prs": {
            "type": "integer"
          },
          "open_prs": {
            "type": "integer"
          },
          "closed_prs": {
            "type": "integer"
          },
          "merged_prs": {
            "type": "integer"
          },
          "total_additions": {
            "type": "integer"
          },
          "total_deletions": {
            "type": "integer"
          },
          "total_files_changed": {
            "type": "integer"
          },
          "repositories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "repository_prs": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "PR count per repository"
          },
          "pr_creation_dates": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "PRs created per day"
          },
          "prs_detail": {
            "type": "array",
            "description": "Detailed list of individual PRs",
            "items": {
              "type": "object",
              "properties": {
                "repository": {
                  "type": "string"
                },
                "pr_number": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "open",
                    "closed",
                    "merged"
                  ]
                },
                "additions": {
                  "type": "integer"
                },
                "deletions": {
                  "type": "integer"
                },
                "files_changed": {
                  "type": "integer"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "merged_at": {
                  "type": "string",
                  "format": "date-time",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "AgentScanStartRequest": {
        "type": "object",
        "required": [
          "service",
          "repo",
          "accessToken",
          "branch",
          "instructionPrompt"
        ],
        "properties": {
          "service": {
            "type": "string",
            "description": "Version control service provider",
            "enum": [
              "github",
              "gitlab",
              "azuredevops",
              "bitbucket"
            ],
            "example": "github"
          },
          "repo": {
            "type": "string",
            "description": "Repository identifier (format varies by service)",
            "example": "owner/repository"
          },
          "accessToken": {
            "type": "string",
            "description": "OAuth or personal access token for the VCS service",
            "example": "ghp_xxxxxxxxxxxx"
          },
          "branch": {
            "type": "string",
            "description": "Git branch to analyze",
            "example": "main"
          },
          "instructionPrompt": {
            "type": "string",
            "description": "Analysis type. Use `threat_hunting` for security threat detection.",
            "example": "threat_hunting"
          },
          "commitId": {
            "type": "string",
            "description": "Specific commit SHA to analyze. If omitted, the latest commit on the branch is used.",
            "default": "",
            "example": "abc123def456"
          },
          "includeFiles": {
            "type": "string",
            "description": "Comma-separated glob patterns for files to include in analysis",
            "default": "",
            "example": "src/**/*.py,lib/**/*.js,app/**/*.ts"
          },
          "excludeFiles": {
            "type": "string",
            "description": "Comma-separated glob patterns for files to exclude from analysis",
            "default": "",
            "example": "tests/**,node_modules/**,dist/**"
          },
          "azureDevopsBaseUrl": {
            "type": "string",
            "description": "Base URL for Azure DevOps (for self-hosted instances)",
            "default": "https://dev.azure.com"
          },
          "gitlab_base_url": {
            "type": "string",
            "description": "Base URL for GitLab (for self-hosted instances)",
            "default": "https://gitlab.com"
          },
          "github_base_url": {
            "type": "string",
            "description": "Base URL for GitHub (for GitHub Enterprise Server)",
            "default": "https://github.com"
          },
          "bitbucket_base_url": {
            "type": "string",
            "description": "Base URL for Bitbucket (for Bitbucket Data Center)",
            "default": "https://api.bitbucket.org/2.0"
          }
        }
      },
      "AgentScanStartResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Success message",
            "example": "Scan started successfully"
          },
          "scanId": {
            "type": "string",
            "description": "Unique identifier for the scan. Use this to retrieve results and check status.",
            "example": "aB3xK9mP2q"
          },
          "filesQueued": {
            "type": "integer",
            "description": "Number of files queued for analysis",
            "example": 142
          }
        }
      },
      "AgentScanResultsRequest": {
        "type": "object",
        "required": [
          "repo",
          "scanId"
        ],
        "properties": {
          "repo": {
            "type": "string",
            "description": "Repository identifier",
            "example": "owner/repository"
          },
          "scanId": {
            "type": "string",
            "description": "Scan identifier returned from the start scan endpoint",
            "example": "aB3xK9mP2q"
          }
        }
      },
      "AgentScanResultsResponse": {
        "type": "object",
        "properties": {
          "scanId": {
            "type": "string",
            "description": "Scan identifier",
            "example": "aB3xK9mP2q"
          },
          "repoName": {
            "type": "string",
            "description": "Repository name",
            "example": "owner/repository"
          },
          "status": {
            "type": "string",
            "description": "Current status of the scan",
            "enum": [
              "completed",
              "in_progress"
            ],
            "example": "completed"
          },
          "results": {
            "type": "array",
            "description": "List of file results with issues found",
            "items": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string",
                  "description": "File path where issues were found",
                  "example": "src/auth/login.py"
                },
                "scan_id": {
                  "type": "string",
                  "description": "Scan identifier"
                },
                "issues": {
                  "type": "array",
                  "description": "List of issues found in the file",
                  "items": {
                    "$ref": "#/components/schemas/AgentIssue"
                  }
                }
              }
            }
          },
          "totalIssues": {
            "type": "integer",
            "description": "Total number of deduplicated issues found across all files",
            "example": 5
          }
        }
      },
      "AgentIssue": {
        "type": "object",
        "description": "An issue found by the AI agent during analysis",
        "properties": {
          "relevant_file": {
            "type": "string",
            "description": "File path where the issue was found",
            "example": "src/auth/login.py"
          },
          "language": {
            "type": "string",
            "description": "Programming language of the file",
            "example": "python"
          },
          "suggestion_content": {
            "type": "string",
            "description": "Detailed description of the issue in markdown format, including the problem, impact, and suggested fix",
            "example": "The `authenticate` function does not validate the length of the password parameter before passing it to the bcrypt hashing function."
          },
          "start_line": {
            "type": "integer",
            "description": "Starting line number of the issue",
            "example": 45
          },
          "end_line": {
            "type": "integer",
            "description": "Ending line number of the issue",
            "example": 52
          },
          "one_sentence_summary": {
            "type": "string",
            "description": "Brief one-sentence summary of the issue",
            "example": "Password length not validated before bcrypt hashing"
          },
          "label": {
            "type": "string",
            "description": "Category label for the issue (e.g., Security, Bug, Performance)",
            "example": "Security"
          },
          "severity": {
            "type": "string",
            "description": "Severity level of the issue",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ],
            "example": "medium"
          },
          "cwe_id": {
            "type": "string",
            "description": "Common Weakness Enumeration (CWE) identifier, when applicable",
            "example": "CWE-916"
          },
          "exploitability": {
            "type": "string",
            "description": "Assessment of how exploitable the issue is (included for security findings)",
            "example": "Requires attacker to know the truncation behavior of bcrypt"
          },
          "agent_instructions": {
            "type": "string",
            "description": "The analysis instructions or prompt that the agent used when it found this issue (e.g., threat_hunting, bug_finding, or custom rules)",
            "example": "threat_hunting"
          }
        }
      },
      "AgentScanHistoryRequest": {
        "type": "object",
        "required": [
          "repo"
        ],
        "properties": {
          "repo": {
            "type": "string",
            "description": "Repository identifier",
            "example": "owner/repository"
          }
        }
      },
      "AgentScanHistoryResponse": {
        "type": "object",
        "properties": {
          "scans": {
            "type": "array",
            "description": "List of past agent scans, sorted by most recent first",
            "items": {
              "type": "object",
              "properties": {
                "service": {
                  "type": "string",
                  "description": "VCS service used for the scan",
                  "example": "github"
                },
                "repo_name": {
                  "type": "string",
                  "description": "Repository name",
                  "example": "owner/repository"
                },
                "branch": {
                  "type": "string",
                  "description": "Branch that was scanned",
                  "example": "main"
                },
                "commit_id": {
                  "type": "string",
                  "description": "Commit SHA that was scanned",
                  "example": "abc123def456"
                },
                "scan_id": {
                  "type": "string",
                  "description": "Unique scan identifier",
                  "example": "aB3xK9mP2q"
                },
                "prompt": {
                  "type": "string",
                  "description": "Analysis prompt or type used for the scan",
                  "example": "threat_hunting"
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time",
                  "description": "When the scan was initiated",
                  "example": "2025-03-15T10:30:00Z"
                },
                "num_files": {
                  "type": "integer",
                  "description": "Number of files that were analyzed",
                  "example": 142
                }
              }
            }
          }
        }
      },
      "AuditEvent": {
        "type": "object",
        "properties": {
          "event_id": {
            "type": "string",
            "description": "Immutable unique event id (32-char hex)",
            "example": "a3f9c2e1b4d84f7a9c0e5d6b7a8f9012"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 UTC",
            "example": "2026-07-30T09:14:03.512345Z"
          },
          "action": {
            "type": "string",
            "description": "Stable machine action name (domain.verb)",
            "example": "rbac.role_update"
          },
          "description": {
            "type": "string",
            "description": "Human-readable action description",
            "example": "Access control: role update"
          },
          "actor_type": {
            "type": "string",
            "enum": [
              "user",
              "system",
              "service_account",
              "integration"
            ],
            "description": "Never an unattributed 'unknown'"
          },
          "actor_id": {
            "type": "string",
            "description": "User sub or stable system identity",
            "example": "harshit-dubey"
          },
          "actor_email": {
            "type": "string",
            "nullable": true,
            "example": "admin@example.com"
          },
          "org": {
            "type": "string",
            "example": "Example-Org"
          },
          "service": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azuredevops"
            ]
          },
          "base_url_domain": {
            "type": "string",
            "description": "Git platform host (self-hosted aware)",
            "example": "github.com"
          },
          "source": {
            "type": "string",
            "enum": [
              "ui",
              "api",
              "scheduled_job",
              "system"
            ],
            "description": "Channel the action came from"
          },
          "target_type": {
            "type": "string",
            "nullable": true,
            "example": "rbac"
          },
          "target_id": {
            "type": "string",
            "nullable": true,
            "example": "role_7d2f"
          },
          "target_name": {
            "type": "string",
            "nullable": true,
            "description": "Affected resource name/path/repository",
            "example": "Security Reviewer"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "success",
              "denied",
              "failure"
            ]
          },
          "status_code": {
            "type": "integer",
            "description": "HTTP status of the audited request",
            "example": 200
          },
          "method": {
            "type": "string",
            "example": "POST"
          },
          "path": {
            "type": "string",
            "example": "/settings/rbac/roles/update"
          },
          "ip": {
            "type": "string",
            "example": "203.0.113.42"
          },
          "user_agent": {
            "type": "string",
            "description": "May contain commas or line breaks — always quoted in CSV output"
          },
          "request_id": {
            "type": "string",
            "description": "Correlation id shared with server logs"
          },
          "changes": {
            "type": "object",
            "nullable": true,
            "description": "Per-field before/after values for configuration, permission and security changes. Sensitive keys are '<redacted>'.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "before": {
                  "nullable": true
                },
                "after": {
                  "nullable": true
                }
              }
            }
          },
          "details": {
            "type": "object",
            "nullable": true,
            "description": "Redacted, truncated request summary. Never raw payloads, tokens or secrets.",
            "additionalProperties": true
          }
        }
      },
      "AuditEventsRequest": {
        "type": "object",
        "required": [
          "platform",
          "org"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Inclusive UTC start date. Default: last 7 days; clamped to the 180-day retention window."
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "description": "Inclusive UTC end date. Default: today."
          },
          "days": {
            "type": "integer",
            "description": "Alternative to explicit dates: lookback window in days (max 180)."
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "Only events STRICTLY AFTER this ISO 8601 timestamp; also defaults the range to [since, today]. Use your last consumed event's timestamp for incremental pulls."
          },
          "cursor": {
            "type": "string",
            "description": "Opaque cursor from a previous response — resume paging after it."
          },
          "limit": {
            "type": "integer",
            "default": 100,
            "maximum": 1000,
            "description": "Events per page."
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "ndjson",
              "csv"
            ],
            "default": "json",
            "description": "json returns the envelope below; ndjson/csv return the raw file body with paging in X-Next-Cursor / X-Has-More headers. CSV is RFC 4180 (fields with commas, quotes or line breaks are properly quoted)."
          }
        }
      },
      "AuditEventsResponse": {
        "type": "object",
        "properties": {
          "org": {
            "type": "string"
          },
          "service": {
            "type": "string"
          },
          "base_url_domain": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "format": "date"
          },
          "end_date": {
            "type": "string",
            "format": "date"
          },
          "retention_days": {
            "type": "integer",
            "example": 180
          },
          "count": {
            "type": "integer",
            "description": "Events in this page"
          },
          "has_more": {
            "type": "boolean",
            "description": "True when more pages match — call again with next_cursor"
          },
          "next_cursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page; also a durable resume point"
          },
          "events": {
            "type": "array",
            "description": "Events in ascending timestamp order (oldest first)",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            }
          }
        }
      },
      "ContainerScanContextRequest": {
        "type": "object",
        "required": [
          "platform",
          "org"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          }
        }
      },
      "Container": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Registry repository name",
            "example": "backend/api"
          },
          "image": {
            "type": "string",
            "description": "Full image reference that was scanned",
            "example": "123456789.dkr.ecr.us-east-1.amazonaws.com/backend/api:latest"
          },
          "tag": {
            "type": "string",
            "example": "latest"
          },
          "cloud": {
            "type": "string",
            "enum": [
              "aws",
              "azure",
              "gcp"
            ]
          },
          "registry": {
            "type": "string",
            "enum": [
              "ECR",
              "ACR",
              "GAR"
            ]
          },
          "region": {
            "type": "string",
            "example": "us-east-1"
          },
          "scan_id": {
            "type": "string",
            "description": "Latest scan of this container; pass to the results endpoint",
            "example": "aB3xK9mP2q"
          },
          "status": {
            "type": "string",
            "description": "Latest scan status",
            "example": "completed"
          },
          "severity_rollup": {
            "type": "object",
            "description": "Vulnerability counts by severity for the latest scan",
            "example": {
              "critical": 2,
              "high": 11,
              "medium": 30,
              "low": 7,
              "unknown": 0
            }
          },
          "findings_total": {
            "type": "integer",
            "example": 50
          },
          "last_scan": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ContainerFinding": {
        "type": "object",
        "properties": {
          "uid": {
            "type": "string",
            "description": "Stable finding identifier"
          },
          "image": {
            "type": "string",
            "description": "Image the vulnerability was found in"
          },
          "kind": {
            "type": "string",
            "description": "Finding kind, e.g. os-pkgs or lang-pkgs",
            "example": "os-pkgs"
          },
          "target": {
            "type": "string",
            "description": "Scanned target inside the image",
            "example": "debian 12.5"
          },
          "id": {
            "type": "string",
            "description": "Vulnerability identifier",
            "example": "CVE-2024-12345"
          },
          "package": {
            "type": "string",
            "example": "libssl3"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low",
              "unknown"
            ]
          },
          "installed_version": {
            "type": "string",
            "example": "3.0.11-1"
          },
          "fixed_version": {
            "type": "string",
            "example": "3.0.13-1"
          },
          "title": {
            "type": "string",
            "example": "openssl: denial of service via crafted certificate"
          },
          "primary_url": {
            "type": "string",
            "example": "https://avd.aquasec.com/nvd/cve-2024-12345"
          },
          "epss_details": {
            "type": "object",
            "description": "EPSS exploit-probability enrichment, when available"
          },
          "public_exploit": {
            "type": "object",
            "description": "Known public exploit references, when available"
          }
        }
      },
      "ContainerScanResultsRequest": {
        "type": "object",
        "required": [
          "platform",
          "org",
          "scan_id"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          },
          "scan_id": {
            "type": "string",
            "description": "Scan identifier from the containers list",
            "example": "aB3xK9mP2q"
          },
          "cloud": {
            "type": "string",
            "enum": [
              "aws",
              "azure",
              "gcp"
            ],
            "default": "aws",
            "description": "Cloud the scan ran against (from the containers list)"
          }
        }
      },
      "HotlistFilters": {
        "type": "object",
        "description": "Values within one dimension are ORed; dimensions are ANDed together. Omit a dimension, or send an empty list, to leave it unfiltered. Use the `facets` of a previous response to discover the values available in your organization.",
        "properties": {
          "types": {
            "type": "array",
            "description": "Scanner that produced the finding.",
            "items": {
              "type": "string",
              "enum": [
                "SCA",
                "SAST",
                "Secrets",
                "IaC",
                "Infrastructure",
                "AI Exploitation"
              ]
            }
          },
          "severities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "critical",
                "high",
                "medium",
                "low",
                "unknown"
              ]
            }
          },
          "locations": {
            "type": "array",
            "description": "Repository full names, or cloud account identifiers for Infrastructure findings.",
            "items": {
              "type": "string"
            }
          },
          "ticket_statuses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "created",
                "not_created"
              ]
            }
          },
          "assignees": {
            "type": "array",
            "description": "Assignee email (lowercased) or provider user id, as returned in each finding's `assignee`.",
            "items": {
              "type": "string"
            }
          },
          "provider_statuses": {
            "type": "array",
            "description": "Native workflow state names from the linked ticket provider, e.g. `In Progress`.",
            "items": {
              "type": "string"
            }
          },
          "sla_statuses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "breached",
                "on_track",
                "met",
                "no_sla"
              ]
            }
          },
          "compliance": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "soc2"
              ]
            }
          },
          "validation": {
            "type": "array",
            "description": "Restrict to findings CodeAnt has actively proven exploitable.",
            "items": {
              "type": "string",
              "enum": [
                "exploit_confirmed"
              ]
            }
          }
        }
      },
      "HotlistFindingsRequest": {
        "type": "object",
        "description": "Ranked Hotlist page request.",
        "required": [
          "platform",
          "org"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          },
          "filters": {
            "$ref": "#/components/schemas/HotlistFilters"
          },
          "search": {
            "type": "string",
            "description": "Case-insensitive substring match over the finding title, identifier, location and file path."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 30,
            "description": "Findings per page."
          },
          "cursor": {
            "type": "string",
            "description": "Opaque `next_cursor` from the previous page. A cursor is bound to the snapshot revision and to the exact `filters` + `search` it was issued for; changing either, or a rebuild of the Hotlist, returns 409 `HOTLIST_CURSOR_STALE` and pagination must restart."
          }
        }
      },
      "HotlistExportRequest": {
        "type": "object",
        "description": "Excel export request. `filters` and `search` behave exactly as they do for the findings endpoint, and the workbook contains every matching finding — not just one page.",
        "required": [
          "platform",
          "org"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          },
          "filters": {
            "$ref": "#/components/schemas/HotlistFilters"
          },
          "search": {
            "type": "string",
            "description": "Case-insensitive substring match over the finding title, identifier, location and file path."
          }
        }
      },
      "HotlistFinding": {
        "type": "object",
        "description": "One deduplicated, priority-scored Hotlist finding. Fields that do not apply to a finding's `type` are absent or null.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable 32-character identifier for this finding across snapshots.",
            "example": "9f2c1d7a4b6e0f3c8a5d2e1b7c4f6a09"
          },
          "type": {
            "type": "string",
            "enum": [
              "SCA",
              "SAST",
              "Secrets",
              "IaC",
              "Infrastructure",
              "AI Exploitation"
            ]
          },
          "title": {
            "type": "string",
            "description": "CVE id, rule message, secret type or cloud check title.",
            "example": "CVE-2024-21538"
          },
          "subtitle": {
            "type": "string",
            "description": "Supporting identifier, e.g. `package @ version` for SCA.",
            "example": "cross-spawn @ 7.0.3"
          },
          "repo": {
            "type": "string",
            "description": "Repository full name; empty for cloud findings."
          },
          "account": {
            "type": "string",
            "description": "Cloud account identifier for Infrastructure findings."
          },
          "maxSeverity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low",
              "unknown"
            ]
          },
          "filePath": {
            "type": "string"
          },
          "lineNumber": {
            "description": "Line number, or the region / resource locator for cloud findings.",
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "priorityScore": {
            "type": "number",
            "description": "Ranking score. Findings are returned in descending priority order.",
            "example": 82.5
          },
          "priorityBoosts": {
            "type": "array",
            "description": "Signals that raised the score above the severity baseline.",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "example": "kev"
                },
                "label": {
                  "type": "string",
                  "example": "CISA KEV"
                },
                "value": {
                  "type": "number"
                }
              }
            }
          },
          "exploitConfirmed": {
            "type": "boolean",
            "description": "CodeAnt proved this finding exploitable — a validated live secret, a confirmed cloud exploit path, or a malware package."
          },
          "kev": {
            "type": "boolean",
            "description": "Listed in the CISA Known Exploited Vulnerabilities catalog."
          },
          "fixable": {
            "type": "boolean",
            "description": "A fixed version or remediation is available."
          },
          "direct": {
            "type": "boolean",
            "description": "SCA only — a direct rather than transitive dependency."
          },
          "reachabilityStatus": {
            "type": "string",
            "description": "SCA only — whether the vulnerable code is reachable from your application.",
            "enum": [
              "reachable",
              "not_reachable",
              "unknown"
            ]
          },
          "cveId": {
            "type": "string"
          },
          "package": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "complianceFrameworks": {
            "type": "array",
            "description": "Frameworks this finding maps to.",
            "items": {
              "type": "string",
              "example": "soc2"
            }
          },
          "nonProd": {
            "type": "boolean",
            "description": "The repository is marked non-production in its risk settings."
          },
          "ticketStatus": {
            "type": "string",
            "enum": [
              "created",
              "not_created"
            ]
          },
          "ticketProvider": {
            "type": "string",
            "description": "Tracker holding the ticket.",
            "example": "Jira"
          },
          "ticketUrl": {
            "type": "string"
          },
          "assignee": {
            "type": "object",
            "nullable": true,
            "description": "Assignee on the linked ticket.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "providerStatus": {
            "type": "object",
            "nullable": true,
            "description": "Native workflow state of the linked ticket.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "example": "In Progress"
              },
              "type": {
                "type": "string",
                "example": "started"
              }
            }
          },
          "slaDays": {
            "type": "integer",
            "nullable": true,
            "description": "SLA applied to this finding, in days."
          },
          "slaDueDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "slaStatus": {
            "type": "string",
            "enum": [
              "breached",
              "on_track",
              "met",
              "no_sla"
            ]
          },
          "raw": {
            "type": "object",
            "description": "Scanner fields kept for deep-linking and detail rendering. Code blocks, autofix payloads and plaintext secret material are never included."
          },
          "rank": {
            "type": "integer",
            "description": "1-based position in the ranked list."
          },
          "source": {
            "type": "string",
            "description": "Scanner the finding came from, before IaC/cloud types are merged."
          },
          "score": {
            "type": "number",
            "description": "Severity/CVSS/EPSS base score before the priority boosts are applied."
          },
          "epss": {
            "type": "number",
            "description": "EPSS exploit-probability, 0-1. Always 0 for organization-level SCA rows."
          },
          "validationStatus": {
            "type": "string",
            "description": "Secrets only — result of validating the credential against its provider.",
            "enum": [
              "live",
              "revoked",
              "pending",
              "unknown"
            ]
          },
          "ticketCreatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "providerIssueKey": {
            "type": "string",
            "nullable": true,
            "description": "Human-readable key of the linked ticket.",
            "example": "COD-1110"
          },
          "providerSyncError": {
            "type": "string",
            "nullable": true,
            "description": "Why the last sync with the ticket provider failed, if it did."
          }
        }
      },
      "HotlistSummary": {
        "type": "object",
        "description": "Headline counts for exactly the findings the request matched.",
        "properties": {
          "total": {
            "type": "integer"
          },
          "severity": {
            "type": "object",
            "description": "Count per severity.",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "exploitConfirmed": {
            "type": "integer"
          },
          "ticketed": {
            "type": "integer"
          }
        }
      },
      "HotlistBuildingResponse": {
        "type": "object",
        "description": "The Hotlist snapshot is being materialized. Retry after `retry_after_seconds`.",
        "properties": {
          "state": {
            "type": "string",
            "example": "building"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "retry_after_seconds": {
            "type": "integer",
            "example": 3
          }
        }
      },
      "HotlistErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "HOTLIST_CURSOR_STALE"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "DismissFindingsRequest": {
        "type": "object",
        "required": [
          "platform",
          "org",
          "repo",
          "analysis_type",
          "dismiss_keys"
        ],
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "github",
              "gitlab",
              "bitbucket",
              "azure_devops"
            ],
            "description": "Git platform of the organization"
          },
          "org": {
            "type": "string",
            "description": "Organization / workspace slug"
          },
          "repo": {
            "type": "string",
            "description": "Repository full name the findings belong to",
            "example": "owner/repository"
          },
          "github_base_url": {
            "type": "string",
            "description": "Self-hosted instance URL (also gitlab_base_url / bitbucket_base_url / azure_devops_base_url). Defaults to the cloud host.",
            "example": "https://github.com"
          },
          "analysis_type": {
            "type": "string",
            "enum": [
              "sast",
              "sca",
              "secrets",
              "iac"
            ],
            "description": "Scanner the findings come from. `raw.analysis_type` from the Hotlist API maps directly (`security` is accepted as an alias of `sast`)."
          },
          "dismiss_keys": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string"
            },
            "description": "Finding identifiers to dismiss — one request dismisses any number of findings in one repo. Take them verbatim from `raw.dismiss_key` of the Hotlist API (`/api/security/hotlist/findings`), or build them from the per-repo results:\n\n- **sca** — `package@version` dismisses every advisory of the package; `package@version::<manifest relative_path>::<cve_id>` dismisses one advisory.\n- **sast** — `<file_path>||::||<context_code_block>||::||<test_id>`.\n- **secrets** — `<file_path>||::||<hashed_secret>:occurrence:<n>||::||<type>` (`n` is the 0-based index among identical secrets in that file).\n- **iac** — `<file_path>||::||<check_id>||::||<start_line>-<end_line>`.",
            "example": [
              "cross-spawn@7.0.3::package-lock.json::CVE-2024-21538",
              "lodash@4.17.20"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Shown as the dismissal reason in the dashboard.",
            "example": "This alert is inaccurate or incorrect"
          },
          "comment": {
            "type": "string",
            "description": "Free-text note stored with the dismissal."
          },
          "dismissed_by": {
            "type": "string",
            "description": "Attribution recorded on the dismissal; defaults to `api`.",
            "example": "sec-automation@example.com"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "CodeAnt API token (`cdt_...`), created on the Settings → API Tokens page. Pass via `Authorization: Bearer <token>` header."
      }
    }
  },
  "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."
    },
    {
      "name": "Audit Logs",
      "description": "Read-only access to your organization's audit trail for compliance, ETL and SIEM ingestion. Events are immutable, retained for 180 days, and cover security-relevant actions: user management, access control, credentials, scan triggers, configuration changes and data exports. Secrets and tokens are redacted and never appear in any response format."
    },
    {
      "name": "Container Scanning",
      "description": "Container image vulnerability scanning across AWS ECR, Azure ACR, and GCP GAR registries. List tracked containers with their latest scan, then fetch the full vulnerability findings of a scan — the same data shown on the Cloud Security → Container Scanning page. Authenticate with a CodeAnt API token (requires the `view_cloud_security: read` permission when token scoping is configured)."
    },
    {
      "name": "Security Hotlist",
      "description": "The organization-wide security Hotlist: every SCA, SAST, secrets, IaC, cloud (CSPM) and AI-exploitation finding, deduplicated and priority-scored into one ranked list with live ticket, assignee and SLA state. Query it with filters, facets and cursor pagination, or export the full filtered list as an Excel workbook. Authenticate with a CodeAnt API token (requires the `view_code_security: read` permission when token scoping is configured)."
    }
  ]
}
