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
{
"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
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
| Parameter | Type | Description |
|---|---|---|
id | string | Repository config ID |
Response
{
"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
| Field | Type | Required | Description |
|---|---|---|---|
repositoryName | string | Yes | Full repository name (e.g., org/repo) |
branch | string | Yes | Git branch to scan |
terraformPaths | string[] | No | Paths to Terraform files |
provider | string | Yes | Cloud provider (aws, azure, gcp) |
scheduleCron | string | No | Cron expression for scheduled scans |
Response
{
"success": true,
"data": {
"_id": "abc123",
"repositoryName": "org/terraform-infra",
"branch": "main",
"provider": "aws"
}
}Example
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
| Parameter | Type | Description |
|---|---|---|
id | string | Repository 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
| Parameter | Type | Description |
|---|---|---|
id | string | Repository 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
| Parameter | Type | Description |
|---|---|---|
id | string | Repository config ID |
Response
{
"success": true,
"data": {
"totalScans": 45,
"totalDrifts": 128,
"resolvedDrifts": 96,
"lastScanAt": "2025-06-15T10:30:00.000Z",
"lastScanStatus": "completed"
}
}Example
curl -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/repo-configs/abc123/stats