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

# Violations

> Get a paginated list of security violations

# Violations API

Access and manage security violations via API.

## List Violations

```http theme={null}
GET /v1/violations?repository_id=repo_123&severity=critical,high
```

**Response**:

```json theme={null}
{
  "violations": [
    {
      "violation_id": "vio_789",
      "title": "SQL Injection in user_controller.py",
      "severity": "CRITICAL",
      "cvss_score": 9.1,
      "epss_score": 68.5,
      "type": "SAST",
      "status": "OPEN",
      "file_path": "api/user_controller.py",
      "line_number": 45
    }
  ],
  "pagination": {
    "page": 1,
    "total": 27
  }
}
```

## Get Violation Details

```http theme={null}
GET /v1/violations/:violation_id
```

**Response**:

```json theme={null}
{
  "violation_id": "vio_789",
  "title": "SQL Injection in user_controller.py",
  "description": "User input directly interpolated into SQL query...",
  "severity": "CRITICAL",
  "cvss_score": 9.1,
  "epss_score": 68.5,
  "type": "SAST",
  "cwe": "CWE-89",
  "status": "OPEN",
  "file_path": "api/user_controller.py",
  "line_number": 45,
  "code_snippet": "query = f\"SELECT * FROM users WHERE id = {user_id}\"",
  "remediation": "Use parameterized queries...",
  "first_detected": "2024-03-10T08:15:00Z",
  "last_seen": "2024-03-15T14:35:42Z"
}
```

## Update Violation Status

```http theme={null}
POST /v1/violations/:violation_id/suppress
```

**Request**:

```json theme={null}
{
  "justification": "Input validated on line 42 before use"
}
```

## What's Next?

<CardGroup cols={2}>
  <Card title="Scans API" icon="play" href="/api-reference/scans">
    Trigger scans
  </Card>

  <Card title="Repositories API" icon="folder" href="/api-reference/repositories">
    Manage repositories
  </Card>
</CardGroup>


## OpenAPI

````yaml GET /violations
openapi: 3.0.3
info:
  title: CodeThreat API
  version: 1.0.0
  description: >-
    Autonomous AppSec Engineering Platform - Comprehensive REST API for security
    scanning, vulnerability management, and DevSecOps automation. Integrate
    CodeThreat's powerful security analysis into your CI/CD pipeline, CLI tools,
    and third-party applications.
  contact:
    name: CodeThreat Support
    url: https://codethreat.com/support
    email: support@codethreat.com
  license:
    name: Proprietary
    url: https://codethreat.com/terms
  termsOfService: https://codethreat.com/terms
servers:
  - url: https://app.codethreat.com/api/v1
    description: Production Server
  - url: http://localhost:3000/api/v1
    description: Development Server
security:
  - ApiKeyAuth: []
tags:
  - name: Organizations
    description: Organization management and configuration
  - name: Repositories
    description: Repository management and status tracking
  - name: Scans
    description: Security scan execution, monitoring, and results
  - name: Violations
    description: Security violation tracking and management
  - name: CLI
    description: CLI-specific endpoints for authentication and configuration
  - name: System
    description: Health checks and system status
paths:
  /violations:
    get:
      tags:
        - Violations
      summary: List violations
      description: Get a paginated list of security violations
      operationId: listViolations
      parameters:
        - $ref: '#/components/parameters/PageParam'
        - $ref: '#/components/parameters/LimitParam'
        - name: scanId
          in: query
          schema:
            type: string
        - name: repositoryId
          in: query
          schema:
            type: string
        - name: severity
          in: query
          schema:
            type: string
            enum:
              - critical
              - high
              - medium
              - low
              - info
        - name: status
          in: query
          schema:
            type: string
            enum:
              - open
              - fixed
              - ignored
              - false_positive
        - name: ruleId
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ViolationListResponse'
components:
  parameters:
    PageParam:
      name: page
      in: query
      description: Page number
      schema:
        type: integer
        minimum: 1
        default: 1
    LimitParam:
      name: limit
      in: query
      description: Items per page
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
  schemas:
    ViolationListResponse:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/Violation'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
        pagination:
          $ref: '#/components/schemas/Pagination'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
    Violation:
      type: object
      properties:
        id:
          type: string
        scanId:
          type: string
        repositoryId:
          type: string
        ruleId:
          type: string
        severity:
          type: string
          enum:
            - critical
            - high
            - medium
            - low
            - info
        status:
          type: string
          enum:
            - open
            - fixed
            - ignored
            - false_positive
        title:
          type: string
        description:
          type: string
        file:
          type: string
        line:
          type: integer
        column:
          type: integer
        codeSnippet:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Pagination:
      type: object
      properties:
        page:
          type: integer
          minimum: 1
        limit:
          type: integer
          minimum: 1
          maximum: 100
        total:
          type: integer
          minimum: 0
        totalPages:
          type: integer
          minimum: 0
        hasNext:
          type: boolean
        hasPrev:
          type: boolean
    ResponseMeta:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        version:
          type: string
        requestId:
          type: string
        organizationId:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication. Generate from your organization settings.

````