---
title: "Update custom allocation rule"
method: PATCH
path: "/api/v2/cost/arbitrary_rule/{rule_id}"
tags: ["Cloud Cost Management"]
---

# Update custom allocation rule

`PATCH /api/v2/cost/arbitrary_rule/{rule_id}`

Update an existing custom allocation rule with new filters and allocation strategy.

**Strategy Methods:**
- **PROPORTIONAL/EVEN**: Allocates costs proportionally/evenly based on existing costs. Requires: granularity, allocated_by_tag_keys. Optional: based_on_costs, allocated_by_filters, evaluate_grouped_by_tag_keys, evaluate_grouped_by_filters.
- **PROPORTIONAL_TIMESERIES/EVEN_TIMESERIES**: Allocates based on timeseries data. Requires: granularity, based_on_timeseries. Optional: evaluate_grouped_by_tag_keys.
- **PERCENT**: Allocates fixed percentages to specific tags. Requires: allocated_by (array of percentage allocations).
- **USAGE_METRIC**: Allocates based on usage metrics (implementation varies).

**Filter Conditions:**
- Use **value** for single-value conditions: "is", "is not", "contains", "=", "!=", "like", "not like"
- Use **values** for multi-value conditions: "in", "not in"
- Cannot use both value and values simultaneously.

**Supported operators**: is, is not, contains, in, not in, =, !=, like, not like

## Path parameters

- `rule_id` integer, required

## Request body

- ArbitraryCostUpsertRequest — The definition of `ArbitraryCostUpsertRequest` object.
  - `data` ArbitraryCostUpsertRequestData — The definition of `ArbitraryCostUpsertRequestData` object.
    - `attributes` ArbitraryCostUpsertRequestDataAttributes — The definition of `ArbitraryCostUpsertRequestDataAttributes` object.
      - `costs_to_allocate` ArbitraryCostUpsertRequestDataAttributesCostsToAllocateItems[], required — The `attributes` `costs_to_allocate`.
        - `condition` string, required — The `items` `condition`.
        - `tag` string, required — The `items` `tag`.
        - `value` string — The `items` `value`.
        - `values` string[], nullable — The `items` `values`.
      - `enabled` boolean — The `attributes` `enabled`.
      - `order_id` integer — The `attributes` `order_id`.
      - `provider` string[], required — The `attributes` `provider`.
      - `rejected` boolean — The `attributes` `rejected`.
      - `rule_name` string, required — The `attributes` `rule_name`.
      - `strategy` ArbitraryCostUpsertRequestDataAttributesStrategy, required — The definition of `ArbitraryCostUpsertRequestDataAttributesStrategy` object.
        - `allocated_by` ArbitraryCostUpsertRequestDataAttributesStrategyAllocatedByItems[] — The `strategy` `allocated_by`.
          - `allocated_tags` ArbitraryCostUpsertRequestDataAttributesStrategyAllocatedByItemsAllocatedTagsItems[], required — The `items` `allocated_tags`.
            - `key` string, required — The `items` `key`.
            - `value` string, required — The `items` `value`.
          - `percentage` number, double, required — The `items` `percentage`. The numeric value format should be a 32bit float value.
        - `allocated_by_filters` ArbitraryCostUpsertRequestDataAttributesStrategyAllocatedByFiltersItems[] — The `strategy` `allocated_by_filters`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `allocated_by_tag_keys` string[] — The `strategy` `allocated_by_tag_keys`.
        - `based_on_costs` ArbitraryCostUpsertRequestDataAttributesStrategyBasedOnCostsItems[] — The `strategy` `based_on_costs`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `based_on_timeseries` object — The `strategy` `based_on_timeseries`.
        - `evaluate_grouped_by_filters` ArbitraryCostUpsertRequestDataAttributesStrategyEvaluateGroupedByFiltersItems[] — The `strategy` `evaluate_grouped_by_filters`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `evaluate_grouped_by_tag_keys` string[] — The `strategy` `evaluate_grouped_by_tag_keys`.
        - `granularity` string — The `strategy` `granularity`.
        - `method` string, required — The `strategy` `method`.
      - `type` string, required — The `attributes` `type`.
    - `id` string — The `ArbitraryCostUpsertRequestData` `id`.
    - `type` 'upsert_arbitrary_rule', required — Upsert arbitrary rule resource type.

## Response `200`

OK

- ArbitraryRuleResponse — The definition of `ArbitraryRuleResponse` object.
  - `data` ArbitraryRuleResponseData — The definition of `ArbitraryRuleResponseData` object.
    - `attributes` ArbitraryRuleResponseDataAttributes — The definition of `ArbitraryRuleResponseDataAttributes` object.
      - `costs_to_allocate` ArbitraryRuleResponseDataAttributesCostsToAllocateItems[], required — The `attributes` `costs_to_allocate`.
        - `condition` string, required — The `items` `condition`.
        - `tag` string, required — The `items` `tag`.
        - `value` string — The `items` `value`.
        - `values` string[], nullable — The `items` `values`.
      - `created` string, date-time, required — The `attributes` `created`.
      - `enabled` boolean, required — The `attributes` `enabled`.
      - `last_modified_user_uuid` string, required — The `attributes` `last_modified_user_uuid`.
      - `order_id` integer, required — The `attributes` `order_id`.
      - `processing_status` string — The `attributes` `processing_status`.
      - `provider` string[], required — The `attributes` `provider`.
      - `rejected` boolean — The `attributes` `rejected`.
      - `rule_name` string, required — The `attributes` `rule_name`.
      - `strategy` ArbitraryRuleResponseDataAttributesStrategy, required — The definition of `ArbitraryRuleResponseDataAttributesStrategy` object.
        - `allocated_by` ArbitraryRuleResponseDataAttributesStrategyAllocatedByItems[] — The `strategy` `allocated_by`.
          - `allocated_tags` ArbitraryRuleResponseDataAttributesStrategyAllocatedByItemsAllocatedTagsItems[], required — The `items` `allocated_tags`.
            - `key` string, required — The `items` `key`.
            - `value` string, required — The `items` `value`.
          - `percentage` number, double, required — The `items` `percentage`. The numeric value format should be a 32bit float value.
        - `allocated_by_filters` ArbitraryRuleResponseDataAttributesStrategyAllocatedByFiltersItems[] — The `strategy` `allocated_by_filters`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `allocated_by_tag_keys` string[] — The `strategy` `allocated_by_tag_keys`.
        - `based_on_costs` ArbitraryRuleResponseDataAttributesStrategyBasedOnCostsItems[] — The `strategy` `based_on_costs`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `based_on_timeseries` object — The rule `strategy` `based_on_timeseries`.
        - `evaluate_grouped_by_filters` ArbitraryRuleResponseDataAttributesStrategyEvaluateGroupedByFiltersItems[] — The `strategy` `evaluate_grouped_by_filters`.
          - `condition` string, required — The `items` `condition`.
          - `tag` string, required — The `items` `tag`.
          - `value` string — The `items` `value`.
          - `values` string[], nullable — The `items` `values`.
        - `evaluate_grouped_by_tag_keys` string[] — The `strategy` `evaluate_grouped_by_tag_keys`.
        - `granularity` string — The `strategy` `granularity`.
        - `method` string, required — The `strategy` `method`.
      - `type` string, required — The `attributes` `type`.
      - `updated` string, date-time, required — The `attributes` `updated`.
      - `version` integer, required — The `attributes` `version`.
    - `id` string — The `ArbitraryRuleResponseData` `id`.
    - `type` 'arbitrary_rule', required — Arbitrary rule resource type.

## Other responses

- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
