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

# List custom allocation rules{% #list-custom-allocation-rules %}
Copy pageCopied
{% tab title="v2" %}

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

### Overview

List all custom allocation rules - Retrieve a list of all custom allocation rules for the organization

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.



### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
The definition of `ArbitraryRuleResponseArray` object.

| Parent field                | Field                                     | Type      | Description                                                                       |
| --------------------------- | ----------------------------------------- | --------- | --------------------------------------------------------------------------------- |
|                             | data [*required*]                    | [object]  | The `ArbitraryRuleResponseArray` `data`.                                          |
| data                        | attributes                                | object    | The definition of `ArbitraryRuleResponseDataAttributes` object.                   |
| attributes                  | costs_to_allocate [*required*]       | [object]  | The `attributes` `costs_to_allocate`.                                             |
| costs_to_allocate           | condition [*required*]               | string    | The `items` `condition`.                                                          |
| costs_to_allocate           | tag [*required*]                     | string    | The `items` `tag`.                                                                |
| costs_to_allocate           | value                                     | string    | The `items` `value`.                                                              |
| costs_to_allocate           | values                                    | [string]  | The `items` `values`.                                                             |
| attributes                  | created [*required*]                 | date-time | The `attributes` `created`.                                                       |
| attributes                  | enabled [*required*]                 | boolean   | The `attributes` `enabled`.                                                       |
| attributes                  | last_modified_user_uuid [*required*] | string    | The `attributes` `last_modified_user_uuid`.                                       |
| attributes                  | order_id [*required*]                | int64     | The `attributes` `order_id`.                                                      |
| attributes                  | processing_status                         | string    | The `attributes` `processing_status`.                                             |
| attributes                  | provider [*required*]                | [string]  | The `attributes` `provider`.                                                      |
| attributes                  | rejected                                  | boolean   | The `attributes` `rejected`.                                                      |
| attributes                  | rule_name [*required*]               | string    | The `attributes` `rule_name`.                                                     |
| attributes                  | strategy [*required*]                | object    | The definition of `ArbitraryRuleResponseDataAttributesStrategy` object.           |
| strategy                    | allocated_by                              | [object]  | The `strategy` `allocated_by`.                                                    |
| allocated_by                | allocated_tags [*required*]          | [object]  | The `items` `allocated_tags`.                                                     |
| allocated_tags              | key [*required*]                     | string    | The `items` `key`.                                                                |
| allocated_tags              | value [*required*]                   | string    | The `items` `value`.                                                              |
| allocated_by                | percentage [*required*]              | double    | The `items` `percentage`. The numeric value format should be a 32bit float value. |
| strategy                    | allocated_by_filters                      | [object]  | The `strategy` `allocated_by_filters`.                                            |
| allocated_by_filters        | condition [*required*]               | string    | The `items` `condition`.                                                          |
| allocated_by_filters        | tag [*required*]                     | string    | The `items` `tag`.                                                                |
| allocated_by_filters        | value                                     | string    | The `items` `value`.                                                              |
| allocated_by_filters        | values                                    | [string]  | The `items` `values`.                                                             |
| strategy                    | allocated_by_tag_keys                     | [string]  | The `strategy` `allocated_by_tag_keys`.                                           |
| strategy                    | based_on_costs                            | [object]  | The `strategy` `based_on_costs`.                                                  |
| based_on_costs              | condition [*required*]               | string    | The `items` `condition`.                                                          |
| based_on_costs              | tag [*required*]                     | string    | The `items` `tag`.                                                                |
| based_on_costs              | value                                     | string    | The `items` `value`.                                                              |
| based_on_costs              | values                                    | [string]  | The `items` `values`.                                                             |
| strategy                    | based_on_timeseries                       | object    | The rule `strategy` `based_on_timeseries`.                                        |
| strategy                    | evaluate_grouped_by_filters               | [object]  | The `strategy` `evaluate_grouped_by_filters`.                                     |
| evaluate_grouped_by_filters | condition [*required*]               | string    | The `items` `condition`.                                                          |
| evaluate_grouped_by_filters | tag [*required*]                     | string    | The `items` `tag`.                                                                |
| evaluate_grouped_by_filters | value                                     | string    | The `items` `value`.                                                              |
| evaluate_grouped_by_filters | values                                    | [string]  | The `items` `values`.                                                             |
| strategy                    | evaluate_grouped_by_tag_keys              | [string]  | The `strategy` `evaluate_grouped_by_tag_keys`.                                    |
| strategy                    | granularity                               | string    | The `strategy` `granularity`.                                                     |
| strategy                    | method [*required*]                  | string    | The `strategy` `method`.                                                          |
| attributes                  | type [*required*]                    | string    | The `attributes` `type`.                                                          |
| attributes                  | updated [*required*]                 | date-time | The `attributes` `updated`.                                                       |
| attributes                  | version [*required*]                 | int32     | The `attributes` `version`.                                                       |
| data                        | id                                        | string    | The `ArbitraryRuleResponseData` `id`.                                             |
| data                        | type [*required*]                    | enum      | Arbitrary rule resource type. Allowed enum values: `arbitrary_rule`               |
|                             | meta                                      | object    | The `ArbitraryRuleResponseArray` `meta`.                                          |
| meta                        | total_count                               | int64     | The `meta` `total_count`.                                                         |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "like",
            "tag": "service",
            "value": "orgstore-csm*",
            "values": null
          }
        ],
        "created": "2024-11-20T03:44:37Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid",
        "order_id": 1,
        "processing_status": "done",
        "provider": [
          "gcp"
        ],
        "rule_name": "gcp-orgstore-csm-team-allocation",
        "strategy": {
          "allocated_by": [
            {
              "allocated_tags": [
                {
                  "key": "team",
                  "value": "csm-activation"
                }
              ],
              "percentage": 0.34
            },
            {
              "allocated_tags": [
                {
                  "key": "team",
                  "value": "csm-agentless"
                }
              ],
              "percentage": 0.66
            }
          ],
          "method": "percent"
        },
        "type": "shared",
        "updated": "2025-09-02T21:28:32Z",
        "version": 1
      },
      "id": "19",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "is",
            "tag": "env",
            "value": "staging",
            "values": null
          }
        ],
        "created": "2025-05-27T18:48:05Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid-2",
        "order_id": 2,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "test-even-2",
        "strategy": {
          "allocated_by_tag_keys": [
            "team"
          ],
          "based_on_costs": [
            {
              "condition": "is",
              "tag": "aws_product",
              "value": "s3",
              "values": null
            }
          ],
          "granularity": "daily",
          "method": "even"
        },
        "type": "shared",
        "updated": "2025-09-03T21:00:49Z",
        "version": 1
      },
      "id": "311",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "is",
            "tag": "servicename",
            "value": "s3",
            "values": null
          }
        ],
        "created": "2025-03-21T20:42:40Z",
        "enabled": false,
        "last_modified_user_uuid": "user-example-uuid-3",
        "order_id": 3,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "test-s3-timeseries",
        "strategy": {
          "granularity": "daily",
          "method": "proportional_timeseries"
        },
        "type": "shared",
        "updated": "2025-09-02T21:16:50Z",
        "version": 1
      },
      "id": "289",
      "type": "arbitrary_rule"
    },
    {
      "attributes": {
        "costs_to_allocate": [
          {
            "condition": "=",
            "tag": "aws_product",
            "value": "msk",
            "values": null
          },
          {
            "condition": "is",
            "tag": "product",
            "value": "null",
            "values": null
          }
        ],
        "created": "2025-08-27T14:39:31Z",
        "enabled": true,
        "last_modified_user_uuid": "user-example-uuid-4",
        "order_id": 4,
        "processing_status": "done",
        "provider": [
          "aws"
        ],
        "rule_name": "azure-unallocated-by-product-2",
        "strategy": {
          "allocated_by_tag_keys": [
            "aws_product"
          ],
          "based_on_costs": [
            {
              "condition": "=",
              "tag": "aws_product",
              "value": "msk",
              "values": null
            },
            {
              "condition": "is not",
              "tag": "product",
              "value": "null",
              "values": null
            }
          ],
          "granularity": "daily",
          "method": "proportional"
        },
        "type": "shared",
        "updated": "2025-09-02T21:28:32Z",
        "version": 1
      },
      "id": "523",
      "type": "arbitrary_rule"
    }
  ]
}
```

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

##### 
                  \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/cost/arbitrary_rule" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
List custom allocation rules returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudCostManagementApi(api_client)
    response = api_instance.list_custom_allocation_rules()

    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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# List custom allocation rules returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new
p api_instance.list_custom_allocation_rules()
```

#### 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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// List custom allocation rules 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())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudCostManagementApi(apiClient)
	resp, r, err := api.ListCustomAllocationRules(ctx)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CloudCostManagementApi.ListCustomAllocationRules`:\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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// List custom allocation rules 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.ArbitraryRuleResponseArray;

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

    try {
      ArbitraryRuleResponseArray result = apiInstance.listCustomAllocationRules();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CloudCostManagementApi#listCustomAllocationRules");
      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_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// List custom allocation rules returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CloudCostManagementAPI::with_config(configuration);
    let resp = api.list_custom_allocation_rules().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
##### 

```typescript
/**
 * List custom allocation rules returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CloudCostManagementApi(configuration);

apiInstance
  .listCustomAllocationRules()
  .then((data: v2.ArbitraryRuleResponseArray) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

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