API Reference
Drift
Get Drift Summary
- API Name: Get Drift Summary
- API Route:
GET /api/v1/drift - Request:
- Query Params:
workspaceId(string, required),projectId(string, required)
- Query Params:
- What it does: Fetches the latest drift detection run for a workspace and returns a summary including status, drifted resource count, individual drifted resources, and the current schedule configuration.
- Returns:
json
{
"status": "never_run | running | clean | drift_detected | error",
"lastRun": { "id", "status", "output", "metadata", "startedAt", "endedAt", ... },
"totalResources": 0,
"driftedCount": 0,
"driftedResources": [...],
"schedule": { "enabled", "cron", "humanReadable", "nextRun", "lastRun" },
"schedules": [...]
}Trigger Drift Check
- API Name: Trigger Drift Detection Run
- API Route:
POST /api/v1/drift - Request:
- Body:
json
{
"workspaceId": "string (required)",
"projectId": "string (required)"
}- What it does: Starts a new Terraform drift check asynchronously using
terraform plan -detailed-exitcode. Creates a log record immediately and runs the actual check in the background so the response returns instantly. - Returns:
{ "runId": "string" }— the ID of the created log record for polling status.
Get Drift History
- API Name: Get Drift Run History
- API Route:
GET /api/v1/drift/history - Request:
- Query Params:
workspaceId(string, required),projectId(string, required)
- Query Params:
- What it does: Returns a list of all past drift check runs for the workspace, ordered by most recent first.
- Returns: Array of drift run log objects.
Get Drift Run Details
- API Name: Get Specific Drift Run
- API Route:
GET /api/v1/drift/[runId] - Request:
- Params:
runId(string) — Drift run ID
- Params:
- What it does: Returns the full details of a specific drift run, including Terraform plan output and parsed drifted resources from metadata.
- Returns: The drift run log object with full output and metadata.
Ignore Drifted Resource
- API Name: Ignore Drifted Resource
- API Route:
POST /api/v1/drift/[runId]/ignore - Request:
- Params:
runId(string) — Drift run ID - Body:
- Params:
json
{
"resourceAddress": "string (required)"
}- What it does: Marks a specific drifted resource within a run as ignored, so it won't trigger alerts.
- Returns: The updated run metadata.
Cancel Drift Check
- API Name: Cancel Drift Check Run
- API Route:
POST /api/v1/drift/[runId]/cancel - Request:
- Params:
runId(string) — Drift run ID
- Params:
- What it does: Cancels a currently running drift check by updating its status to cancelled in the database.
- Returns:
{ "success": true }
AI Suggest for Drift
- API Name: AI Suggestions for Drifted Resources
- API Route:
POST /api/v1/drift/ai-suggest - Request:
- Body:
json
{
"resources": [
{
"address": "string",
"type": "string",
"severity": "critical | warning | info",
"action": "update | create | delete",
"changes": [ { "attribute", "before", "after", "action" } ]
}
]
}- What it does: Uses an Azure OpenAI model to analyze one or multiple drifted Terraform resources and provide actionable recommendations. For a single resource it gives a brief analysis; for multiple resources it groups by severity and provides consolidated recommendations. The response is streamed as text.
- Returns: Streaming text response with AI-generated drift analysis and recommendations.
Reconcile Drift
- API Name: Reconcile Infrastructure Drift
- API Route:
POST /api/v1/drift/reconcile - Request:
- Body:
json
{
"workspaceId": "string (required)",
"projectId": "string (required)"
}- What it does: Runs
terraform applyto reconcile the detected drift by reverting infrastructure back to the Terraform-defined state. - Returns: The result of the terraform apply execution.
List Drift Schedules
- API Name: List Workspace Schedules
- API Route:
GET /api/v1/drift/schedule - Request:
- Query Params:
workspaceId(string, required),projectId(string, required)
- Query Params:
- What it does: Returns all scheduled drift checks configured for the workspace.
- Returns:
{ "schedules": [ { "id", "scheduleType", "cron", "label", "enabled", "lastRunAt", "nextRunAt" } ] }
Create Drift Schedule
- API Name: Create Drift Schedule
- API Route:
POST /api/v1/drift/schedule - Request:
- Body:
json
{
"workspaceId": "string (required)",
"projectId": "string (required)",
"scheduleType": "string (required)",
"cron": "string (required)",
"label": "string (optional)",
"enabled": "boolean (optional, default: false)"
}- What it does: Creates a new workspace schedule. If
enabledistrue, also registers the schedule with the dynamic cron scheduler for automatic execution. - Returns: The created schedule object.
Update Drift Schedule
- API Name: Update Drift Schedule
- API Route:
PUT /api/v1/drift/schedule/[scheduleId] - Request:
- Params:
scheduleId(string) — Schedule ID - Body:
{ "cron", "label", "enabled" }(all optional)
- Params:
- What it does: Updates an existing schedule's cron expression, label, or enabled state. Syncs changes with the dynamic scheduler.
- Returns: The updated schedule object.
Delete Drift Schedule
- API Name: Delete Drift Schedule
- API Route:
DELETE /api/v1/drift/schedule/[scheduleId] - Request:
- Params:
scheduleId(string) — Schedule ID
- Params:
- What it does: Deletes a drift schedule and removes it from the dynamic cron scheduler.
- Returns:
{ "success": true }