Skip to main content
POST
Create billing rule

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Scopes

write

Grants write access

Body

application/json

Create a BillingRule. MSP rules apply to managed accounts. Rules on any other account apply to that account's own costs. Managed accounts cannot manage billing rules. Requires the Owner, Integration Owner, or Manager role.

type
enum<string>
required

The type of the BillingRule. Note: the values are case insensitive.

Available options:
exclusion,
adjustment,
credit,
charge,
custom
title
string
required

The title of the BillingRule.

sql_query
string
required

The SQL query for the BillingRule. Required for Custom rules. Example value: UPDATE costs SET costs.amount = costs.amount * 0.95

start_period
string

The start period of the BillingRule. DEPRECATED: use start_date instead.

start_date
string

The start date of the BillingRule. ISO 8601 formatted.

end_date
string

The end date of the BillingRule. ISO 8601 formatted.

apply_to_all
boolean

Whether the BillingRule applies to all current and future managed accounts. Has no effect when the rule applies to this account's own costs.

charge_type
string

The charge type of the BillingRule. Required for Exclusion rules.

percentage
number<double>

The percentage of the cost shown. Required for Adjustment rules. Example value: 75.0

provider
enum<string>

Limits an adjustment to costs from one provider. Use the provider key, for example aws, azure, azure_csp, or mongo. Omit it to include every provider. Send an empty string when updating to remove the limit.

Available options:
aws,
azure,
gcp,
snowflake,
databricks,
mongo,
datadog,
fastly,
new_relic,
opencost,
open_ai,
oracle,
confluent,
planetscale,
coralogix,
kubernetes,
custom_provider,
github,
linode,
grafana,
clickhouse,
temporal,
twilio,
azure_csp,
kubernetes_agent,
anthropic,
anyscale,
cursor,
elastic,
vercel,
redis_cloud,
circle_ci,
modal,
eleven_labs,
baseten,
cloudflare,
fireworks_ai,
cartesia,
depot,
xai,
digital_ocean,
together_ai,
coreweave,
devin,
openrouter,
deepgram,
crusoe,
sentry_billing,
ramp,
dynatrace,
cockroachdb_cloud,
telnyx,
zilliz,
heroku,
launchdarkly,
gitlab,
scaleway
service
string

The service of the BillingRule. Required for Charge and Credit rules.

category
string

The category of the BillingRule. Required for Charge and Credit rules.

sub_category
string

The subcategory of the BillingRule. Required for Charge and Credit rules.

amount
number<double>

The amount for the BillingRule. Required for Charge and Credit rules. Example value: 300

schema
enum<string>

The dataset for a custom SQL rule. Use costs for Vantage cost data or aws for the raw AWS Cost and Usage Report. When omitted on create, the dataset is taken from the SQL. When a SQL query is updated without a dataset, the table in the query selects it. Inserts are supported for costs only.

Available options:
aws,
costs
include_credits
boolean | null

Whether a monthly insert rule includes credits in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

include_discounts
boolean | null

Whether a monthly insert rule includes discounts in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

include_refunds
boolean | null

Whether a monthly insert rule includes refunds in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

include_tax
boolean | null

Whether a monthly insert rule includes taxes in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

amortize
boolean | null

Whether a monthly insert rule amortizes the costs it reads. Defaults to false. Only monthly insert rules use this setting.

Response

BillingRule model

token
string
required
title
string
required

The title of the BillingRule.

Example:

"Credit for Unused EC2 Instances"

type
string
required

The type of the BillingRule.

Example:

"credit"

apply_to_all
boolean | null
required

Whether the BillingRule applies to all future managed accounts. False when the rule applies to this account's own costs.

Example:

true

created_by_token
string
required

The token of the Creator of the BillingRule.

Example:

"usr_1234"

created_at
string
required

The date and time, in UTC, the BillingRule was created. ISO 8601 Formatted.

Example:

"2024-06-28T00:00:00Z"

start_date
string | null

The start date of the BillingRule.

Example:

"2024-06-28T00:00:00Z"

end_date
string | null

The end date of the BillingRule.

Example:

"2024-06-28T00:00:00Z"

service
string | null

The service for the BillingRule (Charge).

Example:

"AWS Cloudfront"

category
string | null

The category for the BillingRule (Charge).

Example:

"Support Fee"

percentage
string | null

The percentage of the cost shown for the BillingRule (Adjustment).

Example:

"75.0"

provider
string | null

The provider an adjustment is limited to, for example aws, azure, azure_csp, or mongo. Empty when the adjustment includes every provider.

Example:

"aws"

charge_type
string | null

The charge type for the BillingRule.

Example:

"RIFee"

sub_category
string | null

The subcategory for the BillingRule (Charge).

Example:

"One-time"

start_period
string | null

The start period for the BillingRule (Charge).

Example:

"2024-05-01"

amount
string | null

The amount for the BillingRule (Charge).

Example:

"5000.25"

sql_query
string | null

The SQL query for the BillingRule (Custom).

Example:

"UPDATE costs SET costs.amount = costs.amount * 0.95"

schema
string | null

The dataset for a custom SQL BillingRule. costs is Vantage cost data. aws is the raw AWS Cost and Usage Report.

Example:

"costs"

include_credits
boolean | null

Whether a monthly insert rule includes credits in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

Example:

true

include_discounts
boolean | null

Whether a monthly insert rule includes discounts in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

Example:

true

include_refunds
boolean | null

Whether a monthly insert rule includes refunds in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

Example:

true

include_tax
boolean | null

Whether a monthly insert rule includes taxes in the costs it reads. Defaults to true. Only monthly insert rules use this setting.

Example:

true

amortize
boolean | null

Whether a monthly insert rule amortizes the costs it reads. Defaults to false. Only monthly insert rules use this setting.

Example:

false