> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/chaos-engineering/reference/index.md).

# Chaos Engineering Reference

This section provides comprehensive reference documentation for Harness Chaos Engineering APIs, configurations, and technical specifications.

## API Reference <a href="#api-reference" id="api-reference"></a>

### REST API <a href="#rest-api" id="rest-api"></a>

* **Experiments API**: Create, manage, and execute chaos experiments
* **Faults API**: Access available fault types and configurations
* **Results API**: Retrieve experiment results and metrics
* **Infrastructure API**: Manage target infrastructure and connections

### GraphQL API <a href="#graphql-api" id="graphql-api"></a>

* **Schema Documentation**: Complete GraphQL schema reference
* **Query Examples**: Common queries and mutations
* **Subscription Events**: Real-time experiment updates

## Configuration Reference <a href="#configuration-reference" id="configuration-reference"></a>

### Experiment Configuration <a href="#experiment-configuration" id="experiment-configuration"></a>

```yaml
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosExperiment
metadata:
  name: example-experiment
spec:
  definition:
    scope: Cluster
    permissions:
      - apiGroups: [""]
        resources: ["pods"]
        verbs: ["create", "delete", "get", "list"]
```

### Fault Specifications <a href="#fault-specifications" id="fault-specifications"></a>

* **Infrastructure Faults**: CPU, memory, network, and disk fault configurations
* **Application Faults**: Service mesh and application-level fault specifications
* **Platform Faults**: Kubernetes and cloud provider-specific configurations

## Fault Library <a href="#fault-library" id="fault-library"></a>

### Infrastructure Faults <a href="#infrastructure-faults" id="infrastructure-faults"></a>

* **cpu-hog**: CPU stress testing
* **memory-hog**: Memory exhaustion testing
* **network-latency**: Network delay injection
* **disk-fill**: Disk space exhaustion

### Kubernetes Faults <a href="#kubernetes-faults" id="kubernetes-faults"></a>

* **pod-delete**: Pod termination testing
* **node-drain**: Node evacuation testing
* **container-kill**: Container failure simulation

### Cloud Provider Faults <a href="#cloud-provider-faults" id="cloud-provider-faults"></a>

* **ec2-terminate**: AWS EC2 instance termination
* **vm-stop**: Azure VM shutdown
* **gce-stop**: GCP Compute Engine instance stop

## SDK Reference <a href="#sdk-reference" id="sdk-reference"></a>

### Python SDK <a href="#python-sdk" id="python-sdk"></a>

```python
from harness_chaos import ChaosClient

client = ChaosClient(api_key="your-api-key")
experiment = client.create_experiment(
    name="my-experiment",
    faults=["cpu-hog"],
    targets=["my-service"]
)
```

### Go SDK <a href="#go-sdk" id="go-sdk"></a>

```go
import "github.com/harness/chaos-go-sdk"

client := chaos.NewClient("your-api-key")
experiment, err := client.CreateExperiment(ctx, &chaos.ExperimentRequest{
    Name: "my-experiment",
    Faults: []string{"cpu-hog"},
    Targets: []string{"my-service"},
})
```

### JavaScript SDK <a href="#javascript-sdk" id="javascript-sdk"></a>

```javascript
import { ChaosClient } from '@harness/chaos-js-sdk';

const client = new ChaosClient({ apiKey: 'your-api-key' });
const experiment = await client.createExperiment({
  name: 'my-experiment',
  faults: ['cpu-hog'],
  targets: ['my-service']
});
```

## CLI Reference <a href="#cli-reference" id="cli-reference"></a>

### Installation <a href="#installation" id="installation"></a>

```bash
# Install Harness Chaos CLI <a href="#install-harness-chaos-cli" id="install-harness-chaos-cli"></a>
curl -sSL https://get.harness.io/chaos | bash
```

### Common Commands <a href="#common-commands" id="common-commands"></a>

```bash
# List available experiments <a href="#list-available-experiments" id="list-available-experiments"></a>
harness chaos list experiments

# Create a new experiment <a href="#create-a-new-experiment" id="create-a-new-experiment"></a>
harness chaos create experiment --file experiment.yaml

# Run an experiment <a href="#run-an-experiment" id="run-an-experiment"></a>
harness chaos run experiment my-experiment

# Get experiment results <a href="#get-experiment-results" id="get-experiment-results"></a>
harness chaos get results my-experiment
```

## Webhook Reference <a href="#webhook-reference" id="webhook-reference"></a>

### Event Types <a href="#event-types" id="event-types"></a>

* **experiment.started**: Experiment execution started
* **experiment.completed**: Experiment execution completed
* **experiment.failed**: Experiment execution failed
* **fault.injected**: Fault injection started
* **fault.recovered**: Fault recovery completed

### Payload Structure <a href="#payload-structure" id="payload-structure"></a>

```json
{
  "event": "experiment.completed",
  "timestamp": "2023-06-27T10:30:00Z",
  "experiment": {
    "id": "exp-123",
    "name": "my-experiment",
    "status": "completed",
    "result": "passed"
  }
}
```

## Error Codes <a href="#error-codes" id="error-codes"></a>

### HTTP Status Codes <a href="#http-status-codes" id="http-status-codes"></a>

* **200**: Success
* **400**: Bad Request - Invalid parameters
* **401**: Unauthorized - Invalid API key
* **403**: Forbidden - Insufficient permissions
* **404**: Not Found - Resource not found
* **429**: Too Many Requests - Rate limit exceeded
* **500**: Internal Server Error

### Custom Error Codes <a href="#custom-error-codes" id="custom-error-codes"></a>

* **CE001**: Experiment validation failed
* **CE002**: Target infrastructure unreachable
* **CE003**: Insufficient permissions
* **CE004**: Fault injection failed
* **CE005**: Experiment timeout exceeded

## Limits and Quotas <a href="#limits-and-quotas" id="limits-and-quotas"></a>

### API Rate Limits <a href="#api-rate-limits" id="api-rate-limits"></a>

* **REST API**: 1000 requests per minute
* **GraphQL API**: 500 queries per minute
* **Webhook Delivery**: 100 events per minute

### Resource Limits <a href="#resource-limits" id="resource-limits"></a>

* **Concurrent Experiments**: 50 per account
* **Experiment Duration**: 24 hours maximum
* **Target Resources**: 1000 per experiment

## Version History <a href="#version-history" id="version-history"></a>

### API Versioning <a href="#api-versioning" id="api-versioning"></a>

* **v1**: Current stable version
* **v2**: Beta version with enhanced features
* **Legacy**: Deprecated versions (v0.x)

### Changelog <a href="#changelog" id="changelog"></a>

See our [Release Notes](/release-notes/chaos-engineering.md) for detailed version history and breaking changes.
