> 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/api-reference/cost-management-agent-apis/autostopping.md).

# AutoStopping

Create AutoStopping rules, including dry-run rules that estimate savings without stopping resources, with the Harness AutoStopping API.

The AutoStopping API stops a cloud resource after it stays idle longer than the idle time on its rule, and starts it when access is requested through the load balancer, proxy, or IP address on that rule. A dry-run rule estimates the savings and leaves the resource running. The estimate can take up to 24 hours. Fixed schedules and alerts are part of AutoStopping. Cluster Orchestrator and AI cost governance are separate groups in this API.

## Request basics

* **API token**: Send the token in the `x-api-key` header on every request. Go to [Manage API keys](https://developer.harness.io/harness-platform/use-harness-platform/automation/api/add-and-manage-api-keys) to create an API key and a token.
* **Account ID**: Send the account ID as the `account_id` path parameter. Send the same value as the `accountIdentifier` query parameter on the calls that require it.
* **Base URL**: Send requests to `https://app.harness.io/gateway/lw/api`, followed by the endpoint path.

## Example request

List the AutoStopping rules in an account:

```bash
curl "https://app.harness.io/gateway/lw/api/accounts/ACCOUNT_ID/autostopping/rules?accountIdentifier=ACCOUNT_ID" \
  -H "x-api-key: $HARNESS_API_KEY"
```

Replace `ACCOUNT_ID` with your account ID, and set `HARNESS_API_KEY` to your token.

## Find an endpoint

Endpoint paths are relative to the base URL.

* **Rules**: A rule names the resources it stops, the idle time it waits, and whether it is a dry-run. List rules with `GET /accounts/{account_id}/autostopping/rules`, and create one with `POST /accounts/{account_id}/autostopping/rules`. Go to [AutoStopping Rules](https://developer.harness.io/cloud-cost-management/cost-optimization/autostopping-rules) to create a rule.
* **Load balancers**: A load balancer is one access method a rule uses to detect a request and start a stopped resource. List them with `GET /accounts/{account_id}/autostopping/loadbalancers`.
* **Fixed schedules**: A fixed schedule keeps the rule's resources running during set hours, for example a workday or a maintenance window. List schedules with `GET /accounts/{account_id}/schedules`.
* **Cluster Orchestrator**: Cluster Orchestrator provisions nodes for an Amazon EKS cluster from Spot, On-Demand, and committed capacity. List the clusters connected to Harness with `GET /accounts/{account_id}/clusters`. Go to [Cluster Orchestrator for AWS EKS clusters](https://developer.harness.io/cloud-cost-management/cost-optimization/cluster-orchestrator-for-aws-eks-clusters) to set up Cluster Orchestrator.
* **Alerts**: An alert covers an AutoStopping event. List alerts with `POST /accounts/{account_id}/alerts/list`.
* **AI cost governance**: A policy sets a total or per-provider cap on AI spend. List policies with `POST /accounts/{account_id}/ai-governance/policies/list`.
