List custom allocation rules

GET https://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.eu/api/v2/cost/arbitrary_rulehttps://api.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rulehttps://api.datadoghq.com/api/v2/cost/arbitrary_rulehttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rulehttps://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 to access this endpoint.

Response

OK

The definition of ArbitraryRuleResponseArray object.

Expand All

Field

Type

Description

data [required]

[object]

The ArbitraryRuleResponseArray data.

attributes

object

The definition of ArbitraryRuleResponseDataAttributes object.

costs_to_allocate [required]

[object]

The attributes costs_to_allocate.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

created [required]

date-time

The attributes created.

enabled [required]

boolean

The attributes enabled.

last_modified_user_uuid [required]

string

The attributes last_modified_user_uuid.

order_id [required]

int64

The attributes order_id.

processing_status

string

The attributes processing_status.

provider [required]

[string]

The attributes provider.

rejected

boolean

The attributes rejected.

rule_name [required]

string

The attributes rule_name.

strategy [required]

object

The definition of ArbitraryRuleResponseDataAttributesStrategy object.

allocated_by

[object]

The strategy allocated_by.

allocated_tags [required]

[object]

The items allocated_tags.

key [required]

string

The items key.

value [required]

string

The items value.

percentage [required]

double

The items percentage. The numeric value format should be a 32bit float value.

allocated_by_filters

[object]

The strategy allocated_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

allocated_by_tag_keys

[string]

The strategy allocated_by_tag_keys.

based_on_costs

[object]

The strategy based_on_costs.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

based_on_timeseries

object

The rule strategy based_on_timeseries.

evaluate_grouped_by_filters

[object]

The strategy evaluate_grouped_by_filters.

condition [required]

string

The items condition.

tag [required]

string

The items tag.

value

string

The items value.

values

[string]

The items values.

evaluate_grouped_by_tag_keys

[string]

The strategy evaluate_grouped_by_tag_keys.

granularity

string

The strategy granularity.

method [required]

string

The strategy method.

type [required]

string

The attributes type.

updated [required]

date-time

The attributes updated.

version [required]

int32

The attributes version.

id

string

The ArbitraryRuleResponseData id.

type [required]

enum

Arbitrary rule resource type. Allowed enum values: arbitrary_rule

default: arbitrary_rule

meta

object

The ArbitraryRuleResponseArray meta.

total_count

int64

The meta total_count.

{
  "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"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.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}"
"""
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 and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# 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 and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// 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 and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// 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 and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// 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 and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * 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 and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"