---
title: Search cost recommendations
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Cloud Cost Management
---

# Search cost recommendations{% #search-cost-recommendations %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                   |
| ----------------- | -------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/cost/recommendations |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/cost/recommendations |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/cost/recommendations      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/cost/recommendations      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/cost/recommendations  |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/cost/recommendations     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/cost/recommendations |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/cost/recommendations |

### Overview

List cost recommendations matching a filter, with pagination and sorting.

OAuth apps require the `cloud_cost_management_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#cloud-cost-management) to access this endpoint.



### Arguments

#### Query Strings

| Name        | Type   | Description                                |
| ----------- | ------ | ------------------------------------------ |
| page[size]  | string | Number of results per page (1–10000).      |
| page[token] | string | Pagination token from a previous response. |

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field | Field      | Type     | Description                                                                                   |
| ------------ | ---------- | -------- | --------------------------------------------------------------------------------------------- |
|              | filter     | string   | Filter expression applied to the recommendations.                                             |
|              | sort       | [object] | Ordered list of sort clauses applied to the result set.                                       |
| sort         | expression | string   | Field to sort by (for example, `potential_daily_savings.amount`).                             |
| sort         | order      | string   | Sort direction, either `ASC` or `DESC`.                                                       |
|              | view       | string   | Active view name (for example, `active`, `dismissed`, `open`, `in-progress`, or `completed`). |

{% /tab %}

{% tab title="Example" %}

```json
{
  "filter": "string",
  "sort": [
    {
      "expression": "string",
      "order": "string"
    }
  ],
  "view": "string"
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
A page of cost recommendations with pagination metadata.

| Parent field            | Field                   | Type     | Description                                                                 |
| ----------------------- | ----------------------- | -------- | --------------------------------------------------------------------------- |
|                         | data [*required*]  | [object] | The list of cost recommendations on this page.                              |
| data                    | attributes              | object   | Attributes describing a single cost recommendation.                         |
| attributes              | dd_resource_key         | string   | Datadog resource key identifying the recommended resource.                  |
| attributes              | potential_daily_savings | object   | Estimated daily savings if the recommendation is applied.                   |
| potential_daily_savings | amount                  | double   | Numeric amount of the potential daily savings.                              |
| potential_daily_savings | currency                | string   | ISO 4217 currency code for the savings amount.                              |
| attributes              | recommendation_type     | string   | The kind of recommendation (for example, `terminate` or `rightsize`).       |
| attributes              | resource_id             | string   | Cloud provider identifier of the resource.                                  |
| attributes              | resource_type           | string   | Resource type (for example, `aws_ec2_instance`).                            |
| attributes              | tags                    | [string] | Tags attached to the recommended resource.                                  |
| data                    | id                      | string   | Unique identifier for the recommendation.                                   |
| data                    | type [*required*]  | enum     | Recommendation resource type. Allowed enum values: `recommendation`         |
|                         | meta                    | object   | Top-level JSON:API meta object for paginated cost recommendation responses. |
| meta                    | page                    | object   | Pagination metadata for a page of cost recommendations.                     |
| page                    | filter                  | string   | The filter expression that was applied to produce this page.                |
| page                    | next_page_token         | string   | Opaque token used to fetch the next page; absent on the last page.          |
| page                    | page_size               | int32    | Number of items returned in this page (1–10000).                            |
| page                    | page_token              | string   | Pagination token echoed back from the request.                              |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "dd_resource_key": "string",
        "potential_daily_savings": {
          "amount": "number",
          "currency": "string"
        },
        "recommendation_type": "string",
        "resource_id": "string",
        "resource_type": "string",
        "tags": []
      },
      "id": "string",
      "type": "recommendation"
    }
  ],
  "meta": {
    "page": {
      "filter": "string",
      "next_page_token": "string",
      "page_size": "integer",
      "page_token": "string"
    }
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/cost/recommendations" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "filter": "@resource_table:aws_ec2_instance",
  "sort": [
    {
      "expression": "potential_daily_savings.amount",
      "order": "DESC"
    }
  ]
}
EOF 
                
{% /tab %}
