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

# REST API endpoints for remediation actions

> Submit, approve, execute, and roll back InfraAudit remediation actions for drift and vulnerability findings programmatically through the REST API.

Remediation actions let InfraAudit automatically fix drift and vulnerability findings in your cloud environment. Actions go through an approval gate before execution, and completed actions can be rolled back within a configurable window.

Base path: `/api/v1/remediation`

***

## GET /remediation — list remediation actions

Returns a paginated list of remediation actions.

```http theme={null}
GET /api/v1/remediation
Authorization: Bearer <token>
```

### Query parameters

<ParamField query="status" type="string">
  Filter by status: `pending_approval`, `approved`, `executing`, `completed`, `failed`, or `rolled_back`.
</ParamField>

<ParamField query="resource_id" type="integer">
  Filter by resource.
</ParamField>

<ParamField query="provider_id" type="integer">
  Filter by provider.
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number.
</ParamField>

<ParamField query="per_page" type="integer" default="20">
  Results per page.
</ParamField>

### Response

```json theme={null}
{
  "data": [
    {
      "id": 1,
      "title": "Enable S3 server-side encryption",
      "resource_id": 5,
      "resource_name": "data-lake-bucket",
      "finding_type": "drift",
      "finding_id": 12,
      "status": "pending_approval",
      "risk": "low",
      "created_at": "2024-01-15T14:40:00Z"
    }
  ]
}
```

<ResponseField name="risk" type="string">
  Estimated risk of applying this remediation: `low`, `medium`, or `high`.
</ResponseField>

***

## GET /remediation/{id} — get remediation details

Returns full details including the pre-execution snapshot, estimated risk assessment, and execution log.

```http theme={null}
GET /api/v1/remediation/{id}
Authorization: Bearer <token>
```

***

## POST /remediation — create remediation

Creates a new remediation action for a drift or vulnerability finding.

```http theme={null}
POST /api/v1/remediation
Authorization: Bearer <token>
Content-Type: application/json
```

### Request body

<ParamField body="finding_type" type="string" required>
  The type of finding: `drift` or `vulnerability`.
</ParamField>

<ParamField body="finding_id" type="integer" required>
  The ID of the finding to remediate.
</ParamField>

```json theme={null}
{
  "finding_type": "drift",
  "finding_id": 12
}
```

***

## POST /remediation/{id}/approve — approve a remediation

Approves a remediation action so it can be executed. Action must be in `pending_approval` status.

```http theme={null}
POST /api/v1/remediation/{id}/approve
Authorization: Bearer <token>
Content-Type: application/json
```

### Request body (optional)

<ParamField body="comment" type="string">
  Approval comment for the audit log.
</ParamField>

```json theme={null}
{
  "comment": "Approved — coordinated with infra team"
}
```

***

## POST /remediation/{id}/execute — run a remediation

Executes an approved remediation action against the cloud provider API. Action must be in `approved` status.

```http theme={null}
POST /api/v1/remediation/{id}/execute
Authorization: Bearer <token>
```

### Response `202`

```json theme={null}
{
  "status": "executing",
  "started_at": "2024-01-15T15:00:00Z"
}
```

***

## POST /remediation/{id}/rollback — rollback a remediation

Reverses a completed remediation action. Available within the rollback window after the action reaches `completed` status.

```http theme={null}
POST /api/v1/remediation/{id}/rollback
Authorization: Bearer <token>
```

***

## POST /remediation/{id}/reject — reject a remediation

Rejects a pending remediation action.

```http theme={null}
POST /api/v1/remediation/{id}/reject
Authorization: Bearer <token>
Content-Type: application/json
```

### Request body (optional)

<ParamField body="reason" type="string">
  Reason for rejection.
</ParamField>

```json theme={null}
{
  "reason": "Change not approved by change management"
}
```
