For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/cloud-cost-management/reorder-custom-allocation-rules.md. A documentation index is available at /llms.txt.
Language
Datadog site

Reorder custom allocation rules

POSThttps://api.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us3.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us5.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.datadoghq.eu/api/v2/cost/arbitrary_rule/reorderhttps://api.ap1.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.ap2.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.uk1.datadoghq.com/api/v2/cost/arbitrary_rule/reorderhttps://api.ddog-gov.com/api/v2/cost/arbitrary_rule/reorderhttps://api.us2.ddog-gov.com/api/v2/cost/arbitrary_rule/reorder

Overview

Reorder custom allocation rules - Change the execution order of custom allocation rules.

Important: You must provide the complete list of all rule IDs in the desired execution order. The API will reorder ALL rules according to the provided sequence.

Rules are executed in the order specified, with lower indices (earlier in the array) having higher priority.

Example: If you have rules with IDs [123, 456, 789] and want to change order from 123→456→789 to 456→123→789, send: [{"id": "456"}, {"id": "123"}, {"id": "789"}]

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Field
Type
Description
data [required]
[object]

The ReorderRuleResourceArray data.

Response

Successfully reordered rules

Code Example

Reorder custom allocation rules
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/cost/arbitrary_rule/reorder" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "id": "456",
      "type": "arbitrary_rule"
    },
    {
      "id": "123",
      "type": "arbitrary_rule"
    },
    {
      "id": "789",
      "type": "arbitrary_rule"
    }
  ]
}
EOF