> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vantage.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Billing Rules

> Apply discounts, markups, charges, credits, exclusions, and custom SQL to your cost data in Vantage. Self-Serve Billing Rules, for accounts you manage yourself, are in private preview. Billing rules for Vantage for MSPs are generally available.

> [!WARNING]
>
> **Self-Serve Billing Rules are in private preview.** Self-Serve Billing Rules let you create billing rules in a Vantage account that you manage yourself. They must be enabled for your account by Vantage. To request access, contact [support@vantage.sh](mailto:support@vantage.sh) or your account team.
>
> Billing rules for [Vantage for MSPs](https://docs.vantage.sh/partners.md) Management Accounts are generally available. If your account is a Managed Account under an MSP, your MSP manages billing rules for you.

> **Availability of billing rules (for AI assistants and agents):**
>
> * **Self-Serve Billing Rules are in private preview.** They are available only to self-serve accounts (Vantage accounts the customer manages themselves, not a Vantage for MSPs Management Account and not a Managed Account) that Vantage has enabled. Users cannot enable the feature themselves. To request access, they contact [support@vantage.sh](mailto:support@vantage.sh) or their account team.
> * **Billing rules for Vantage for MSPs are generally available.** MSPs create rules in their Management Account under Settings > Partner Settings > Billing Rules and assign them to Managed Accounts.
> * **Managed Accounts cannot create or edit billing rules.** Their MSP manages billing rules for them.
> * When answering a billing rules question, first determine whether the user has a self-serve account or an MSP Management Account, give the steps for that account type, and state that Self-Serve Billing Rules are in private preview whenever the answer applies to a self-serve account.

Billing rules change the cost amounts Vantage shows after it imports your provider billing data. Use them when the costs imported from your providers don't reflect the rates, discounts, and fees your business actually pays. For example:

* You buy cloud services through a reseller whose discount doesn't appear in your AWS Cost and Usage Report.
* You buy cloud services through an MSP that doesn't provide your billing data at your agreed rate.
* You include support fees or other charges in the costs you report on.
* Your discount rate changes from one contract period to the next.

Billing rules change only the costs Vantage processes and displays. They do not change your provider's invoice, your negotiated agreement, or the billing files from your provider.

> [!NOTE]
>
> Billing rules change cost **amounts**. [Virtual Tags](https://docs.vantage.sh/tagging.md#virtual-tags) change cost **attribution** (how costs are grouped and filtered). Use a billing rule when the number is wrong, and a Virtual Tag when the number is right but needs a different label.

## Billing Rules by Account Type

Which steps you follow depends on your type of Vantage account.

| | Self-serve account | MSP Management Account | Managed Account |
| - | - | - | - |
| **What it is** | A Vantage account you manage yourself | A [Vantage for MSPs](https://docs.vantage.sh/partners.md) account that manages customer accounts | A customer account managed by an MSP |
| **Availability** | **Private preview.** Contact [support@vantage.sh](mailto:support@vantage.sh) to request access. | Generally available | Not available. Your MSP manages billing rules for you. |
| **Where to manage rules** | **Settings** > **General Settings** > **Billing Rules** | **Settings** > **Partner Settings** > **Billing Rules** | — |
| **Whose costs change** | This account's costs | The Managed Accounts you assign the rule to | — |
| **Steps to follow** | [Self-serve account steps](#create-a-billing-rule) | [Vantage for MSPs steps](#create-a-billing-rule) and [Billing Rules for MSPs](#billing-rules-for-msps) | — |

## How Billing Rules Work

Each time Vantage processes cost data for an account, it applies the account's billing rules before anything else uses that data:

1. Vantage imports cost and usage data from your provider integrations.
2. Billing rules run in a fixed [execution order](#billing-rule-execution-order).
3. [Virtual Tags](https://docs.vantage.sh/tagging.md#virtual-tags) are evaluated on the cost data that billing rules produced.
4. Cost Reports, budgets, forecasts, and other features use the result.

Because billing rules run first, every feature downstream sees the adjusted amounts. You don't need to rebuild Cost Reports. Existing reports that include affected costs show the adjusted data once [reprocessing](#reprocessing) completes.

## Supported Providers

| Rule | Supported providers |
| - | - |
| Adjustment (Per Service Adjustment), Charge, Credit, Exclusion, and Custom rules against the `costs` dataset | AWS, Azure, Azure CSP, and MongoDB Atlas |
| Adjustment (Re-Rate to Public Price and Remove RI/SP Discounts) and Custom rules against the `aws` dataset | AWS only |

Billing rules that change line items are not supported today for standard GCP usage costs or most other providers.

## Who Can Manage Billing Rules

Users with the **Organization Owner** or **Integration Owner** role can create, edit, and delete billing rules. See [Role-Based Access Control](https://docs.vantage.sh/rbac.md) for details. Users with other roles can't open **Billing Rules** in Settings, but they see costs with billing rules applied in Cost Reports and across Vantage.

Managed Accounts cannot create or edit billing rules. If your account is a Managed Account, your MSP manages billing rules for you.

## Create a Billing Rule

Select the tab for your account type. If you're not sure which type you have, see [Billing Rules by Account Type](#billing-rules-by-account-type).

**Vantage for MSPs**

**Step 1**

Log in to your Vantage for MSPs Management Account.

**Step 2**

From the top navigation, click **Settings**.

**Step 3**

From the left navigation, under **Partner Settings**, select **Billing Rules**. Your existing billing rules are displayed.

**Step 4**

Click **New Billing Rule**, then select **Adjustment**, **Charge**, **Credit**, **Custom**, or **Exclusion**.

**Step 5**

Enter a **Title** and the fields for the rule type. See [Billing Rule Types](#billing-rule-types).

**Step 6**

Optionally, enter a **Start Date** and **End Date**. Charge and Credit rules require a start date. See [Rule Dates](#rule-dates).

**Step 7**

Optionally, choose to apply the rule to all existing and new Managed Accounts, then click **Save**.

**Step 8**

If you didn't apply the rule to all Managed Accounts, assign it to individual Managed Accounts. See [Assign Billing Rules to a Managed Account](https://docs.vantage.sh/partners.md#assign-billing-rules-to-a-managed-account).

The rule changes only the costs of the Managed Accounts it's assigned to, never the Management Account's own costs. See [Billing Rules for MSPs](#billing-rules-for-msps).

**Self-serve account (private preview)**

> [!WARNING]
>
> Self-Serve Billing Rules are in private preview. If you don't see **Billing Rules** under **General Settings**, the feature is not enabled for your account. Contact [support@vantage.sh](mailto:support@vantage.sh) or your account team to request access.

**Step 1**

From the top navigation, click **Settings**.

**Step 2**

From the left navigation, under **General Settings**, select **Billing Rules**. Your existing billing rules are displayed.

**Step 3**

Click **New Billing Rule**, then select **Adjustment**, **Charge**, **Credit**, **Custom**, or **Exclusion**.

**Step 4**

Enter a **Title** and the fields for the rule type. See [Billing Rule Types](#billing-rule-types).

**Step 5**

Optionally, enter a **Start Date** and **End Date**. Charge and Credit rules require a start date. See [Rule Dates](#rule-dates).

**Step 6**

Click **Save**. The rule applies to this account's costs automatically. The rule form shows an **Applies to Account Costs** panel instead of a Managed Account picker. Vantage begins [reprocessing](#reprocessing) the affected cost data.

## Billing Rule Types

Each billing rule has a type that determines what it does to your cost data: [Adjustment](#adjustment), [Charge and Credit](#charge-and-credit), [Exclusion](#exclusion), or [Custom](#custom). The fields are the same for self-serve and MSP accounts.

### Adjustment

Adjustment rules change the amount of existing cost line items. Select one of the following adjustment types.

> [!NOTE]
>
> You choose the adjustment type when you create the rule and cannot change it afterward. **Re-Rate to Public Price** and **Remove RI/SP Discounts** rules are saved as [Custom](#custom) rules against the `aws` dataset, so they are listed with the **SQL Rule** type and open in the SQL editor when you edit them.

#### Per Service Adjustment

Changes matching line items to a percentage of their original amount. Use it for discounts, markups, and negotiated rates that do not appear in your provider bill.

| Field | Description |
| - | - |
| **Service** | The service to adjust, such as *Amazon CloudFront*. You can also select all services for a provider, or **All Services**. |
| **Category** | Optional. Limits the rule to one cost category within the service, such as *Data Transfer*. |
| **Percentage of Cost Shown to Customer** | The share of the original cost you want Vantage to show. Vantage calculates `new_cost = original_cost × percentage ÷ 100`. For a 10% discount, enter `90`, so \$100 of matching costs becomes \$90. Do not enter `-10`. Values greater than `100` apply a markup; `110` adds 10%. |

On a self-serve account, **Percentage of Cost Shown to Customer** is the share of cost shown in your own account.

> [!TIP]
>
> To see Category names, open a Cost Report, expand **Group By**, and select **Category**.

**Example: Apply a 10% AWS reseller discount**

If you buy AWS through a reseller whose discount does not appear in your Cost and Usage Report, create a **Per Service Adjustment**, set **Service** to all AWS services, and enter `90` as the percentage. Vantage keeps 90% of each matching AWS line item, so Cost Reports show AWS costs with the 10% discount applied. Scope the rule so it applies only to the costs your agreement covers.

If the discount changes over time, create one rule for each contract period and give each rule its own **Start Date** and **End Date**, rather than editing a single rule. See [Rule Dates](#rule-dates).

#### Re-Rate to Public Price

Shows AWS usage at public on-demand rates, removing the effect of Enterprise Discount Programs (EDPs), Private Pricing Agreements (PPAs), and other negotiated pricing. Use it when you need to report or charge back AWS costs at list price.

This adjustment has no additional fields. It supports AWS costs only. Vantage replaces `lineItem/UnblendedCost` with `pricing/publicOnDemandCost` and `lineItem/UnblendedRate` with `pricing/publicOnDemandRate` from the AWS Cost and Usage Report.

#### Remove RI/SP Discounts

Removes Reserved Instance and Savings Plan discounts from usage when the commitment was purchased in a different AWS account than the one that used it. Use it when commitments are bought centrally, such as in a payer account, and you want each account's costs to reflect on-demand pricing instead of the shared discount.

This adjustment has no additional fields. It supports AWS costs only. Vantage rewrites matching `SavingsPlanCoveredUsage` and `DiscountedUsage` line items as `Usage`, so they appear at on-demand rates. Usage covered by a commitment purchased in the same account keeps its discount.

### Charge and Credit

Charge and Credit rules insert a new line item. Use a Charge for fees, such as a support or platform fee, and a Credit for amounts that reduce cost, such as a negotiated service credit.

| Field | Description |
| - | - |
| **Service** | The service the line item is reported under, such as *Amazon CloudFront*. |
| **Category** | The cost category for the line item, such as *Support Fee*. |
| **Subcategory** | The cost subcategory for the line item. |
| **Amount** | A positive number. A Charge adds this amount with the `Usage` charge type. A Credit is recorded as a negative amount with the `Credit` charge type. |
| **Start Date** | Required. The date the rule begins to apply. |

Charges and credits run in the second [execution stage](#billing-rule-execution-order), so later Adjustment and Exclusion rules can act on them.

### Exclusion

Exclusion rules remove line items with a specific charge type from your cost data. Use them to remove items you do not want to report on, such as Reserved Instance fees, taxes, or distributor discounts.

| Field | Description |
| - | - |
| **Charge Type** | The exact charge type value to remove, such as `RIFee` or `DistributorDiscount`. |

The **Charge Type** must exactly match a raw charge type value, including capitalization. The display names shown when you group a Cost Report by **Charge Type**, such as *Reserved Instance Fee*, do not match. Expand the section below for the exact values.

> **Click to view all supported charge type values**
>
> | Exact `costs.cost_type` Value | Definition |
> | - | - |
> | `adjustment` | GCP adjustments due to reasons like goodwill or SLA violations. |
> | `AllocatedAmortizedDiscount` | Savings from commitment-based pricing allocated to the account consuming the commitment. Appears as a negative amount that reduces effective cost from on-demand pricing to the commitment rate. |
> | `AllocatedAmortizedFee` | Savings Plans and Reserved Instances that have been amortized and allocated to an account with usage. This value can appear as a negative cost in the payer account because it is subtracted from the payer account and added to a member account. |
> | `AmortizedBundledDiscount` | Amortized variant of `BundledDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedCredit` | Credit charges that span multiple billing days, amortized across the covered period. |
> | `AmortizedDiscount` | The discount portion of a commitment fee that has been spread across the billing period. Represents the difference between the gross and net amortized upfront commitment cost. |
> | `AmortizedDistributorDiscount` | Amortized variant of `DistributorDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedEdpDiscount` | Amortized variant of `EdpDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedFee` | Amortized Savings Plan and Reserved Instance purchases. |
> | `AmortizedPrivateRateDiscount` | Amortized variant of `PrivateRateDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedPurchase` | Azure reservation and Savings Plan purchases from the amortized cost dataset. |
> | `AmortizedRefund` | Refund charges that span multiple billing days, amortized across the covered period. |
> | `AmortizedRiVolumeDiscount` | Amortized variant of `RiVolumeDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedSppDiscount` | Amortized variant of `SppDiscount`. Appears when amortization and discounts are both enabled. |
> | `AmortizedTax` | Tax charges that span multiple billing days, amortized across the covered period. |
> | `AmortizedUsage` | Usage charges in the amortized cost view. For AWS, this can include commitment-covered usage rewritten to gross cost when blended commitment discounts are enabled. |
> | `BundledDiscount` | Discounted usage for one product or service based on the usage of another product or service. |
> | `COMMITTED_USAGE_DISCOUNT` | GCP Compute Engine resource-based committed use discounts. |
> | `COMMITTED_USAGE_DISCOUNT_DOLLAR_BASE` | GCP spend-based committed use discounts. |
> | `Credit` | Credits applied to your bill. |
> | `DISCOUNT` | Discounts applied by a provider for your usage. |
> | `Discount` | Discounts applied to AWS usage. |
> | `DiscountedUsage` | Reserved Instance discounted spend. |
> | `DistributorDiscount` | Discounts through the AWS Distribution Resellers Program. |
> | `EdpDiscount` | Discounts applied through the AWS Enterprise Discount Program (EDP). |
> | `Fee` | Upfront annual fees paid for subscriptions, such as the fee paid for All Upfront subscriptions. Also used for AWS Marketplace and Support fees. |
> | `FeeTax` | Tax related to `Fee` charges, such as AWS Marketplace tax. |
> | `FEE_UTILIZATION_OFFSET` | Credit that offsets Committed Use Discount fee SKUs when commitments are fully utilized. |
> | `FREE_TIER` | Credits related to GCP Free Tier usage. |
> | `Monthly Minimum Fee` | Minimum fee for Fastly. |
> | `PartnerEarnedCredit` | Credits earned by Azure CSP partners for managing customer Azure resources. |
> | `PrivateRateDiscount` | AWS discount based on private pricing rates. |
> | `PROMOTION` | GCP promotional credits related to items like marketing promotions. |
> | `Purchase` | Azure Marketplace purchases. |
> | `Refund` | Negative charges indicating money refunded by a provider. |
> | `regular` | GCP regular charges. |
> | `RESELLER_MARGIN` | Discounts for the GCP Reseller Program. |
> | `RIFee` | Monthly recurring fees for Reserved Instance subscriptions. |
> | `RiVolumeDiscount` | Volume discounts for large Reserved Instance purchases. |
> | `RoundingAdjustment` | Small adjustments for rounding differences in Azure billing calculations. |
> | `rounding_error` | GCP cost type for rounding errors. |
> | `SavingsPlanCoveredUsage` | Savings Plan discounted spend. |
> | `SavingsPlanRecurringFee` | Hourly recurring charges associated with a No Upfront or Partial Upfront Savings Plan. |
> | `SavingsPlanUpfrontFee` | One-time upfront fee from purchasing All Upfront or Partial Upfront Savings Plans. |
> | `SppDiscount` | Solution Provider Program discount. |
> | `SUBSCRIPTION_BENEFIT` | Credits earned after purchase of long-term subscriptions. |
> | `SUSTAINED_USAGE_DISCOUNT` | Credit for running certain Compute Engine resources for a large portion of the month. |
> | `Tax` | Taxes applied, such as sales tax. |
> | `tax` | Lowercase tax value used by GCP. |
> | `UnamortizedBundledDiscount` | Unamortized variant of `BundledDiscount`. Appears when amortization is disabled and discounts are included. |
> | `UnamortizedCredit` | The original lump-sum credit charge before amortization. |
> | `UnamortizedDiscount` | The discount portion of an unamortized commitment fee. |
> | `UnamortizedDistributorDiscount` | Unamortized variant of `DistributorDiscount`. Appears when amortization is disabled and discounts are included. |
> | `UnamortizedEdpDiscount` | Unamortized variant of `EdpDiscount`. Appears when amortization is disabled and discounts are included. |
> | `UnamortizedFee` | The original lump-sum fee charge before amortization. For AWS, Savings Plan recurring fees can appear as unamortized when blended commitment discounts are enabled. |
> | `UnamortizedPrivateRateDiscount` | Unamortized variant of `PrivateRateDiscount`. Appears when amortization is disabled and discounts are included. |
> | `UnamortizedPurchase` | Azure reservation and Savings Plan purchases from the actual, unamortized cost dataset. |
> | `UnamortizedRefund` | The original lump-sum refund charge before amortization. |
> | `UnamortizedRiVolumeDiscount` | Unamortized variant of `RiVolumeDiscount`. Appears when amortization is disabled and discounts are included. |
> | `UnamortizedSppDiscount` | Unamortized variant of `SppDiscount`. |
> | `UnamortizedTax` | The original lump-sum tax charge before amortization. |
> | `UnamortizedUsage` | Usage charges from the actual, unamortized cost dataset. |
> | `UnusedReservation` | Cost of unused Azure reservation capacity. |
> | `UnusedSavingsPlan` | Cost of unused Azure Savings Plan capacity. |
> | `Usage` | Charges for usage at regular or on-demand rates. |
>
> > [!NOTE]
> >
> > Each AWS discount type in the table above, such as `BundledDiscount`, `EdpDiscount`, and `PrivateRateDiscount`, can also have amortized and unamortized variants that use the raw `costs.cost_type` value with a prefix. For example, `EdpDiscount` can also appear as `AmortizedEdpDiscount` or `UnamortizedEdpDiscount`.
> >
> > * **Amortized variants** such as `AmortizedEdpDiscount` appear when amortization and discounts are both enabled. These represent the discount amount on fee rows, such as Marketplace or Enterprise Support charges, that has been spread across the billing period.
> > * **Unamortized variants** such as `UnamortizedEdpDiscount` appear when amortization is disabled and discounts are included. These represent the discount amount on unamortized fee or commitment rows, such as Reserved Instance fees or Savings Plan recurring fees.
> >
> > The AWS discount types with these variants are: `EdpDiscount`, `BundledDiscount`, `SppDiscount`, `RiVolumeDiscount`, `PrivateRateDiscount`, and `DistributorDiscount`.

### Custom

Custom rules run a SQL `UPDATE`, `INSERT`, or `DELETE` statement against Vantage cost data (the `costs` dataset) or raw AWS Cost and Usage Report data (the `aws` dataset). Use them when no other rule type expresses the logic you need, such as a discount that excludes certain charge types, or a fee calculated from total monthly spend.

The editor includes **Format**, which auto-formats your SQL, and **Validate**, which checks it for syntax errors, schema mismatches, and common issues. See [Validate a Rule Before You Save](#validate-a-rule-before-you-save).

**Example: Apply a discount that excludes Marketplace purchases**

When a discount or fee covers cloud consumption but not Marketplace purchases, use a Custom rule to define which line items it applies to. Excluded line items stay unchanged:

```sql theme={null}
UPDATE costs
SET costs.amount = costs.amount * 0.90
WHERE costs.provider = 'aws'
  AND costs.cost_category NOT IN ('AWS Marketplace', 'Marketplace')
```

To remove Marketplace costs entirely instead, see [Exclude Marketplace Costs](https://docs.vantage.sh/sql_billing_rules.md#exclude-marketplace-costs).

See [SQL Billing Rules](https://docs.vantage.sh/sql_billing_rules.md) for datasets, supported syntax, and examples.

## Validate a Rule Before You Save

Check a rule before you save it, because every save [reprocesses](#reprocessing) your cost data:

* **Validate in the editor:** For Custom rules, click **Validate** above the SQL editor. Validate checks your SQL for syntax errors, unsupported operations, unknown columns, and schema mismatches without saving the rule.
* **Ask the docs assistant:** On the [SQL Billing Rules](https://docs.vantage.sh/sql_billing_rules.md#need-help-writing-a-rule) page, use the AI assistant prompts to draft a rule from a plain-language description, validate a rule you paste in, or troubleshoot a rule that isn't working.
* **Use the Docs MCP:** Connect the [Vantage Docs MCP](https://docs.vantage.sh/docs_mcp.md) to your AI tool so it can check a rule against the billing rules documentation while you write it.

## Rule Dates

Start and end dates are inclusive calendar dates in `YYYY-MM-DD` format:

* **Start date only:** The rule applies from that date forward.
* **End date only:** The rule applies from the beginning of your cost data through that date.
* **Both:** The rule applies only within that window.
* **Neither:** The rule applies to your entire cost history.

Charge and Credit rules require a start date.

To use different rates for different contract periods, create one rule for each period with its own start and end dates. For example, one rule can apply the discount from a previous contract year, and another can apply the current rate. Avoid overlapping date ranges unless you intend both adjustments to apply, because overlapping rules [compound](#why-order-matters).

Use dates instead of date conditions in SQL. A rule with an empty start date reprocesses your entire history, so set a start date when you only need the rule for a recent period.

## Reprocessing

When you save, edit, or delete a billing rule, Vantage reprocesses the affected cost data within the rule's date range. Creating or editing a rule recalculates matching costs with the change, and deleting a rule recalculates them without it.

* Reprocessing runs in the background and can take several hours, depending on the amount of cost data. The console does not show a progress indicator. Vantage processes the most recent data first, so recent results are usually available before reprocessing finishes.
* Saving a rule again restarts reprocessing. Finalize the rule before you save it, then check the results after reprocessing completes.
* How far back a rule applies depends on the historical cost data available in your account.

## Limits

* Each account can have up to 20 billing rules. If you need more, contact [support@vantage.sh](mailto:support@vantage.sh).
* Each rule has one set of conditions. For adjustments with different conditions or rates, create separate rules.

## Billing Rule Execution Order

Billing rules run as a fixed pipeline of four execution stages. The stages always run in the order below, and each rule's stage is determined by its type and schema. This applies to every rule type, including Custom (SQL) rules.

| Stage | Rules | What runs |
| - | - | - |
| 1 | **AWS schema transform rules** | Rules that change or remove raw AWS Cost and Usage Report line items. This includes the **Re-Rate to Public Price** and **Remove RI/SP Discounts** adjustments and Custom rules written against the `aws` dataset. |
| 2 | **COST schema insert rules** | Charges, credits, and Custom `INSERT` rules against the `costs` dataset. These run before stage 3 so later rules can act on the inserted line items. |
| 3 | **COST schema transform rules** | **Per Service Adjustment** rules, exclusions, and Custom `UPDATE` and `DELETE` rules against the `costs` dataset. |
| 4 | **Monthly Insert rules** | Custom [aggregate rules](https://docs.vantage.sh/sql_billing_rules.md#monthly-insert-aggregate-rules) that use functions like `SUM()` to calculate a monthly amount, such as a management fee, from the costs produced by stages 1–3. |

Within a stage, rules run in order. On a self-serve account, that is the order the rules were created, and a new rule is added to the end of its stage. On a Vantage for MSPs account, you can [reorder rules for each Managed Account](https://docs.vantage.sh/partners.md#reorder-billing-rules-for-a-managed-account).

### Why Order Matters

Every rule that matches a line item applies to it, in order, so rules compound. Within a stage, each rule operates on the cost data left by the rule before it, not on the original data, and each stage operates on the output of the stage before it. Review rule conditions, order, and date ranges together to make sure the result matches the pricing you intend.

* **Overlapping percentages compound:** Two 10% discounts (two rules set to `90`) turn \$100 into \$90, then \$81, not \$80. A rule set to `90` followed by a rule set to `95` turns \$100 into \$85.50.
* **Percentages alone are order-independent:** Stacking percentage adjustments produces the same result in either order. A 10% discount and a 5% markup on a \$100 line item yield \$94.05 either way (`100 × 0.90 × 1.05 = 100 × 1.05 × 0.90`).
* **Mixed operations are order-dependent:** Mixing a percentage with a fixed amount or an exclusion does not. If Rule A sets a line item to \$100 and Rule B applies a 90% rate, running A then B produces \$90. Running B then A produces \$100, and the discount is lost.
* **Monthly Insert rules run last:** Aggregate rules calculate from the adjusted costs. If a stage 3 rule removes AWS Marketplace costs, a Monthly Insert rule that charges 10% of AWS spend calculates the fee without those Marketplace costs.

> [!TIP]
>
> Create broad, foundational rules first and narrower corrections afterward. Check totals after reprocessing completes.

## Manage Billing Rules Programmatically

You can also create, list, update, and delete billing rules with the [Billing Rules API](https://docs.vantage.sh/api/billingrules/create-billing-rule.md), the [Terraform provider](https://registry.terraform.io/providers/vantage-sh/vantage/latest/docs/resources/billing_rule), and the billing rules tools in the [Vantage MCP](https://docs.vantage.sh/vantage_mcp.md), which the [FinOps Agent](https://docs.vantage.sh/vantage_finops_agent.md) can also use.

> [!WARNING]
>
> **Self-Serve Billing Rules are in private preview, including through the API, Terraform, and MCP.** On a self-serve account, these tools work only after Vantage enables Self-Serve Billing Rules for the account. Rules created on a self-serve account always apply to that account's own costs, and `apply_to_all` is ignored.

The following examples create a 10% reseller discount.

```bash API theme={null}
curl --request POST \
  --url https://api.vantage.sh/v2/billing_rules \
  --header 'authorization: Bearer <ACCESS_TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
    "type": "adjustment",
    "title": "10% Reseller Discount",
    "percentage": 90
  }'
```

```hcl Terraform theme={null}
resource "vantage_billing_rule" "reseller_discount" {
  title      = "10% Reseller Discount"
  type       = "adjustment"
  percentage = 90
}
```

An Adjustment rule without a `service` or `category` applies to all services. Add `service` and `category` to scope it to the costs your agreement covers. See the [`vantage_billing_rule` resource](https://registry.terraform.io/providers/vantage-sh/vantage/latest/docs/resources/billing_rule) and [`vantage_billing_rules` data source](https://registry.terraform.io/providers/vantage-sh/vantage/latest/docs/data-sources/billing_rules) for all attributes.

## Billing Rules for MSPs

On a [Vantage for MSPs](https://docs.vantage.sh/partners.md) Management Account, billing rules work the same way, with these differences:

* A rule applies to the Managed Accounts you assign it to, not to the Management Account's own costs. Select Managed Accounts, or apply the rule to all current and future Managed Accounts.
* Within a stage, you can [reorder rules for each Managed Account](https://docs.vantage.sh/partners.md#reorder-billing-rules-for-a-managed-account).
* On Managed Accounts, billing rules also record [Build Hours](https://docs.vantage.sh/build_hours.md).

See [Billing Rules for Vantage for MSPs](https://docs.vantage.sh/partners.md#billing-rules) for assignment, reordering, and what customers see in their Managed Accounts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.