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

# Ingest

> Push cluster snapshots and logs

## Push Snapshot

```bash theme={null}
POST /ingest
X-API-Key: cg_your_key
X-Cluster-Id: my-cluster
Content-Type: application/json
Content-Encoding: gzip
```

The agent sends a gzip-compressed JSON payload containing the full cluster state. The backend decompresses, calculates the CSC score, stores the snapshot, persists score history, and evaluates alert rules.

**Response:**

```json theme={null}
{ "status": "ok" }
```

## Push Logs

```bash theme={null}
POST /ingest/logs
X-API-Key: cg_your_key
X-Cluster-Id: my-cluster
Content-Type: application/json
```

```json theme={null}
{
  "namespace": "default",
  "pod": "api-server-abc123",
  "container": "api",
  "lines": [
    { "timestamp": "2026-03-16T12:00:00Z", "message": "Request processed", "level": "INFO" }
  ]
}
```

## Validate Deployment (CI/CD)

```bash theme={null}
POST /api/validate
X-API-Key: cg_your_key (scope: cicd)
Content-Type: application/json
```

```json theme={null}
{
  "cluster_id": "production",
  "resource": "deployment/api-server",
  "namespace": "default",
  "action": "image_update",
  "image": "myapp:v2.1.0",
  "user": "ci-pipeline",
  "source": "github-actions"
}
```

**Response:**

```json theme={null}
{
  "decision": "SAFE",
  "csc_score": 87,
  "risks": [],
  "message": "Deployment validated successfully"
}
```

Decisions: `SAFE` (score ≥ 70), `WARN` (score 50-69), `BLOCK` (score \< 50).
