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

# Cost & Recommendations API

> Query normalized expenses and optimization recommendations from KOSTRA via the REST API.

# Cost & Recommendations API

These endpoints expose the two things most integrations need: what you spent, and what KOSTRA recommends you do about it. All calls require the `x-optscale-token` header (see [Authentication](/api/authentication)).

## Query expenses

```
GET /restapi/v2/organizations/{organization_id}/clean_expenses
```

Returns normalized, resource-level expenses across every connected provider for the organization, filtered by the query parameters you supply. This is the endpoint to pull cost data into a data warehouse or a custom report.

Common query parameters:

| Parameter                | Description                                                                       |
| ------------------------ | --------------------------------------------------------------------------------- |
| `start_date`, `end_date` | The period to report, as Unix timestamps                                          |
| `cloud_account_id`       | Restrict to one or more data sources — for example, a single Huawei Cloud account |
| `pool_id`                | Restrict to a pool in your organization structure                                 |
| `region`                 | Restrict to a cloud region                                                        |
| `resource_type`          | Restrict to a kind of resource                                                    |
| `limit`                  | Cap the number of records returned                                                |

Because expenses are normalized, Huawei Cloud spend is returned in the same shape as AWS, Azure, and Google Cloud, so a single integration handles all providers.

## Pool expense breakdown

```
GET /restapi/v2/pools_expenses/{pool_id}
```

Returns the expense breakdown for a specific pool, useful for building per-team cost views without post-processing the full expense list.

## List recommendations

```
GET /restapi/v2/organizations/{organization_id}/optimizations
```

Returns the organization's optimization findings — the same recommendations shown in the interface, grouped by type, each with the flagged resources and their estimated savings. Use this to feed recommendations into a ticketing system or a savings dashboard.

The response spans every recommendation module that applies to your connected accounts across all providers: abandoned instances, unattached volumes, obsolete snapshots, idle IPs, abandoned load balancers, abandoned object-storage buckets, database rightsizing, and more.

## Recommendations for one resource

```
GET /restapi/v2/resources/{resource_id}/optimizations
```

Returns the recommendations that apply to a single resource, so you can surface "what should I do about this?" in context — for example, next to a resource in your own inventory tool.

## A savings-report integration

A common pattern:

1. `GET .../optimizations` to retrieve current findings and their savings.
2. Filter to the categories or services your team owns.
3. Push each finding to your tracker, and re-pull on a schedule so resolved items drop off as KOSTRA re-evaluates.

## Related pages

* [Data Sources API](/api/data-sources)
* [Chargeback API](/api/chargeback)
* [Act on Recommendations](/guides/act-on-recommendations)
* [Explore Your Costs](/guides/explore-costs)
