Skip to content

Repository Configs

Manage repository scan configurations. A repository config defines which repository, branch, Terraform paths, and credentials to use for drift detection scans.

Base path: /api/repo-configs

Authentication: Bearer token required on all routes

List Configs

GET /api/repo-configs/

Scope: repos:read

List all repository configurations for the authenticated user.

Response

json
{
  "success": true,
  "data": [
    {
      "_id": "abc123",
      "repositoryName": "org/terraform-infra",
      "branch": "main",
      "terraformPaths": ["modules/vpc", "modules/eks"],
      "provider": "aws",
      "lastScanAt": "2025-06-15T10:30:00.000Z",
      "status": "active"
    }
  ]
}

Example

bash
curl -H "Authorization: Bearer TOKEN" \
  https://api.controlinfra.com/api/repo-configs/

Get Config

GET /api/repo-configs/:id

Scope: repos:read

Get a specific repository configuration.

Path Parameters

ParameterTypeDescription
idstringRepository config ID

Response

json
{
  "success": true,
  "data": {
    "_id": "abc123",
    "repositoryName": "org/terraform-infra",
    "branch": "main",
    "terraformPaths": ["modules/vpc"],
    "provider": "aws",
    "scheduleCron": "0 6 * * *",
    "status": "active"
  }
}

Get Config for Edit

GET /api/repo-configs/:id/edit

Scope: repos:write

Get a repository configuration with full details for editing (includes sensitive fields).

Create Config

POST /api/repo-configs/

Scope: repos:write

Create a new repository scan configuration.

Request Body

FieldTypeRequiredDescription
repositoryNamestringYesFull repository name (e.g., org/repo)
branchstringYesGit branch to scan
terraformPathsstring[]NoPaths to Terraform files
providerstringYesCloud provider (aws, azure, gcp)
scheduleCronstringNoCron expression for scheduled scans

Response

json
{
  "success": true,
  "data": {
    "_id": "abc123",
    "repositoryName": "org/terraform-infra",
    "branch": "main",
    "provider": "aws"
  }
}

Example

bash
curl -X POST https://api.controlinfra.com/api/repo-configs/ \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "repositoryName": "org/terraform-infra",
    "branch": "main",
    "terraformPaths": ["modules/vpc"],
    "provider": "aws"
  }'

Update Config

PUT /api/repo-configs/:id

Scope: repos:write

Update an existing repository configuration.

Path Parameters

ParameterTypeDescription
idstringRepository config ID

Request Body

Same fields as Create Config (all optional for update).

Delete Config

DELETE /api/repo-configs/:id

Scope: repos:write

Delete a repository configuration and its associated scan history.

Path Parameters

ParameterTypeDescription
idstringRepository config ID

Get Repository Statistics

GET /api/repo-configs/:id/stats

Scope: repos:read

Get scan and drift statistics for a repository configuration.

Path Parameters

ParameterTypeDescription
idstringRepository config ID

Response

json
{
  "success": true,
  "data": {
    "totalScans": 45,
    "totalDrifts": 128,
    "resolvedDrifts": 96,
    "lastScanAt": "2025-06-15T10:30:00.000Z",
    "lastScanStatus": "completed"
  }
}

Example

bash
curl -H "Authorization: Bearer TOKEN" \
  https://api.controlinfra.com/api/repo-configs/abc123/stats