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

# Repositories

> Get a paginated list of repositories for the authenticated organization

# Repositories API

Manage repositories programmatically via API.

## List Repositories

```http theme={null}
GET /v1/repositories
```

**Response**:

```json theme={null}
{
  "repositories": [
    {
      "repository_id": "repo_123",
      "name": "my-app",
      "vcs_provider": "github",
      "default_branch": "main",
      "last_scan_at": "2024-03-15T14:35:42Z",
      "security_score": 85
    }
  ],
  "pagination": {
    "page": 1,
    "total": 15
  }
}
```

## Get Repository

```http theme={null}
GET /v1/repositories/:repository_id
```

**Response**:

```json theme={null}
{
  "repository_id": "repo_123",
  "name": "my-app",
  "vcs_provider": "github",
  "vcs_url": "https://github.com/org/my-app",
  "default_branch": "main",
  "security_score": 85,
  "total_violations": 27,
  "violations_by_severity": {
    "critical": 2,
    "high": 5,
    "medium": 12,
    "low": 8
  },
  "last_scan_at": "2024-03-15T14:35:42Z",
  "created_at": "2024-01-10T09:00:00Z"
}
```

## Update Repository Settings

```http theme={null}
PATCH /v1/repositories/:repository_id
```

**Request**:

```json theme={null}
{
  "auto_scan_on_push": true,
  "auto_scan_on_pr": true
}
```

## What's Next?

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

  <Card title="Violations API" icon="bug" href="/api-reference/violations">
    View repository violations
  </Card>
</CardGroup>


## OpenAPI

````yaml GET /repositories
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:
  /repositories:
    get:
      tags:
        - Repositories
      summary: List repositories
      description: Get a paginated list of repositories for the authenticated organization
      operationId: listRepositories
      parameters:
        - $ref: '#/components/parameters/PageParam'
        - $ref: '#/components/parameters/LimitParam'
        - name: search
          in: query
          description: Search repositories by name
          schema:
            type: string
        - name: provider
          in: query
          description: Filter by provider
          schema:
            type: string
            enum:
              - github
              - gitlab
              - bitbucket
              - azure_devops
        - name: status
          in: query
          description: Filter by status
          schema:
            type: string
            enum:
              - active
              - inactive
              - archived
        - name: sortBy
          in: query
          schema:
            type: string
            enum:
              - name
              - createdAt
              - updatedAt
              - lastScanAt
            default: updatedAt
        - name: sortOrder
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoryListResponse'
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:
    RepositoryListResponse:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/Repository'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
        pagination:
          $ref: '#/components/schemas/Pagination'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
    Repository:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        url:
          type: string
        provider:
          type: string
          enum:
            - github
            - gitlab
            - bitbucket
            - azure_devops
        status:
          type: string
          enum:
            - active
            - inactive
            - archived
        description:
          type: string
        lastScanAt:
          type: string
          format: date-time
        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.

````