> 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/cloud-cost-management.md).

# Cloud Cost Management

Manage perspectives, budgets, cost categories, anomalies, recommendations, and governance rules with the Harness Cloud Cost Management API.

The Cloud Cost Management (CCM) API reports and controls your cloud and AI spend. Use it to group costs, set budgets, act on anomalies and recommendations, and enforce cost governance rules.

## Request basics

* **API key token**: Send it 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 a key and token.
* **Account ID**: Almost every endpoint takes `accountIdentifier`, as a query parameter or in the path. Most resources sit at account level, so organization and project IDs are rarely needed.
* **Base URL**: Send requests to `https://app.harness.io/gateway/ccm/api`, followed by the endpoint path.

## Example request

List the budgets in your account:

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

Replace `ACCOUNT_ID` with your own values, and set `HARNESS_API_KEY` to your API key token.

## Find an endpoint

Endpoint paths are relative to the base URL.

* **Perspectives**: Saved views that group costs by cloud account, service, label, or cost category. Folders and reports are part of this group. List perspectives with `GET /perspective/getAllPerspectives` and read one with `GET /perspective`. Go to [Perspectives](https://developer.harness.io/cloud-cost-management/cost-reporting/perspectives) to create a perspective.
* **Budgets and budget groups**: Spending limits on a perspective, with alerts when actual or forecast spend crosses a threshold. List budgets with `GET /budgets` and create one with `POST /budgets`. Go to [Budgets](https://developer.harness.io/cloud-cost-management/cost-governance/budgets) to create a budget.
* **Cost categories**: Rules that map costs to business units, teams, or products. List cost categories with `GET /business-mapping`. Go to [Cost Categories](https://developer.harness.io/cloud-cost-management/cost-reporting/cost-categories) to define cost categories.
* **Anomalies**: Unexpected spikes in spend, with comments and an ignore list for known spikes. List anomalies with `POST /anomaly`. Go to [Anomalies](https://developer.harness.io/cloud-cost-management/cost-governance/anomalies) to detect anomalies.
* **Recommendations**: Suggested savings, such as rightsizing workloads and node pools, with Jira and ServiceNow tracking. List recommendations with `POST /recommendation/overview/list`, then read one, for example with `GET /recommendation/details/ec2-instance`. Go to [Recommendations](https://developer.harness.io/cloud-cost-management/cost-optimization/recommendations) to act on recommendations.
* **Asset governance**: Rules, rule sets, and enforcements that find and fix wasteful cloud resources on a schedule. List rules with `POST /governance/rule/list` and enforcements with `GET /governance/enforcement/list`. Go to [Asset Governance](https://developer.harness.io/cloud-cost-management/cost-governance/asset-governance) to set up asset governance.
* **Unit metrics**: Cost per business unit, such as cost per customer or per transaction. Read your unit metrics with `GET /unit-metric`. Go to [Unit Cost Metrics](https://developer.harness.io/cloud-cost-management/use-cacm/unit-costs) to set up unit cost metrics.
