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

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# List Cloud Cost Management cloud accounts{% #list-cloud-cost-management-cloud-accounts %}

{% tab title="v2" %}

| Datadog site      | API endpoint                                                 |
| ----------------- | ------------------------------------------------------------ |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/cost/cloud_accounts |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/cost/cloud_accounts |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/cost/cloud_accounts      |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/cost/cloud_accounts      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/cost/cloud_accounts  |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/cost/cloud_accounts |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/cost/cloud_accounts     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/cost/cloud_accounts |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/cost/cloud_accounts |

### Overview



List the OCI and AWS CUR 2.0 cloud accounts for your organization, including account IDs, status, and validation errors. Use `filter[cloud]=oci` or `filter[cloud]=aws_cur2` to return a single cloud. When omitted or empty, both clouds are returned. AWS CUR 1.0, Azure, and GCP accounts are available through their dedicated configuration endpoints. Archived accounts are excluded. The response contains all matching accounts and is not paginated.

This endpoint replaces `GET /api/v2/cost/oci_config`. To migrate, use `filter[cloud]=oci` and update clients to accept the `cloud_account` resource type instead of `oci_config`. Account IDs and the existing attributes are preserved; each account also includes the `cloud` attribute.
This endpoint requires the `cloud_cost_management_read` permission.
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                                                                                         |
| ------------- | ------ | --------------------------------------------------------------------------------------------------- |
| filter[cloud] | string | Filter by cloud, either `oci` or `aws_cur2` (case insensitive). Omit or leave empty to return both. |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
List of cloud cost accounts.

| Parent field | Field                               | Type     | Description                                                                           |
| ------------ | ----------------------------------- | -------- | ------------------------------------------------------------------------------------- |
|              | data [*required*]              | [object] | The cloud cost accounts matching the filter.                                          |
| data         | attributes [*required*]        | object   | Read-only status and identifiers for a cloud cost account.                            |
| attributes   | account_id [*required*]        | string   | The cloud provider account identifier, such as an OCI tenancy OCID or AWS account ID. |
| attributes   | cloud [*required*]             | string   | The cloud provider and cost report type. Currently supports `oci` and `aws_cur2`.     |
| attributes   | created_at [*required*]        | string   | The timestamp when the cloud account was created.                                     |
| attributes   | error_messages [*required*]    | [string] | Validation errors for the cloud account. Empty when there are no errors.              |
| attributes   | status [*required*]            | string   | The cloud account status, one of `active`, `warn`, `error`, or `disabled`.            |
| attributes   | status_updated_at [*required*] | string   | The timestamp when the cloud account status was last updated.                         |
| attributes   | updated_at [*required*]        | string   | The timestamp when the cloud account was last updated.                                |
| data         | id [*required*]                | string   | The Datadog cloud account ID used by the account filters API.                         |
| data         | type [*required*]              | enum     | Type of a cloud cost account. Allowed enum values: `cloud_account`                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "account_id": "ocid1.tenancy.oc1..example",
        "cloud": "oci",
        "created_at": "2026-01-01T12:00:00Z",
        "error_messages": [
          []
        ],
        "status": "active",
        "status_updated_at": "2026-01-01T12:00:00Z",
        "updated_at": "2026-01-01T12:00:00Z"
      },
      "id": "534",
      "type": "cloud_account"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% 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 %}

{% 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

##### 
                  \# Use a Personal Access Token or Service Access Token export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"  \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/cost/cloud_accounts" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" 
                
##### 

```ruby
# List Cloud Cost Management cloud accounts returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_cost_cloud_accounts_v2()
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
##### 

```python
"""
List Cloud Cost Management cloud accounts returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_cost_cloud_accounts_v2()

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
##### 

```go
// List Cloud Cost Management cloud accounts returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCostCloudAccountsV2(ctx, *datadogV2.NewListCostCloudAccountsV2OptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `CloudCostManagementApi.ListCostCloudAccountsV2`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCostCloudAccountsV2`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
##### 

```java
// List Cloud Cost Management cloud accounts returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudCostManagementApi;
import com.datadog.api.client.v2.model.CloudCostAccountsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient);

    try {
      CloudCostAccountsResponse result = apiInstance.listCostCloudAccountsV2();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCostCloudAccountsV2");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
##### 

```rust
// List Cloud Cost Management cloud accounts returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;
use datadog_api_client::datadogV2::api_cloud_cost_management::ListCostCloudAccountsV2OptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api
        .list_cost_cloud_accounts_v2(ListCostCloudAccountsV2OptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
{% /tab %}
