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

# Get Agent Scan History

> 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.



## OpenAPI

````yaml /openapi.json post /api/analysis/agents/scan/history
openapi: 3.0.3
info:
  title: CodeAnt AI API
  description: >-
    API for code analysis (SAST, SCA, secrets, IaC) and developer productivity
    metrics. Supports GitHub, GitLab, Bitbucket, and Azure DevOps.
  version: 1.0.0
servers:
  - url: https://api.codeant.ai
    description: Production server
security: []
tags:
  - name: Analysis
    description: Code analysis operations
  - name: Agent Analysis
    description: >-
      AI-powered agent analysis operations. Uses LLM-based code exploration
      agents to perform deep security threat hunting, bug finding, and custom
      analysis with reflection-based false positive filtering.
  - name: Developer Metrics — Teams
    description: >-
      Manage developer teams: create, update, delete teams and manage team
      membership. Teams are used to organize developers and scope metrics.
  - name: Developer Metrics
    description: >-
      Developer productivity and activity metrics: active developers, PR
      throughput, individual comparisons, and AI-generated summaries. All
      endpoints support GitHub, GitLab, Bitbucket, and Azure DevOps.
paths:
  /api/analysis/agents/scan/history:
    post:
      tags:
        - Agent Analysis
      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
      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
components:
  schemas:
    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
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message

````