Skip to content
Book a demoContact usGet started

Add Rates To Rate Catalog

rate_catalogs.add_rates(strrate_catalog_id, RateCatalogAddRatesParams**kwargs) -> RateCatalogAddRatesResponse
post/rate-catalogs/{rate_catalog_id}/add_rates

Add Rates To Rate Catalog

ParametersExpand Collapse
rate_catalog_id: str
billing_interval: Literal["monthly", "yearly"]

How often the customer will be billed for these rates.

Accepts one of the following:
"monthly"
"yearly"
fixed_rates: Optional[Iterable[FixedRate]]

The fixed rate to create in the catalog.

code: str

Code of this rate to be used for setting quantity and price multipliers. This code must be unique within the rate card.

name: str

The name of the rate displayed to the customer.

price: FixedRatePrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
price_type: Optional[Literal["flat"]]
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
description: Optional[str]

The description of the rate displayed to the customer.

usage_based_rates: Optional[Iterable[UsageBasedRate]]

The usage based rates to create in the catalog.

Accepts one of the following:
class UsageBasedRateCreateSimpleUsageBasedRateRequest:
code: str

Code of this rate to be used for price multipliers. This code must be unique within the rate card.

name: str

The name of the rate displayed to the customer.

price: UsageBasedRateCreateSimpleUsageBasedRateRequestPrice

Flat price is a price that linearly scales with the quantity.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
price_type: Optional[Literal["flat"]]
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
pricing_metric_id: str

The ID of the pricing metric to use for this rate.

usage_based_rate_type: Literal["simple"]
description: Optional[str]

The description of the rate displayed to the customer.

included_units: Optional[int]

The number of units included in the rate before the price is applied.

minimum0
class UsageBasedRateCreateDimensionalUsageBasedRateRequest:
code: str

Code of this rate to be used for price multipliers. This code must be unique within the rate card.

dimensions: Iterable[UsageBasedRateCreateDimensionalUsageBasedRateRequestDimension]

The dimensions of the rate.

key: str

The name of the dimension. This is used to identify the dimension in the pricing matrix.

values: SequenceNotStr[str]

A list of possible values for the dimension.

description: Optional[str]

The description of the dimension.

name: str

The name of the rate displayed to the customer.

pricing_matrix: UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrix

The pricing matrix of the rate.

cells: Iterable[UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrixCell]
dimension_coordinates: Dict[str, str]

A key-value mapping of dimension keys and values to identify the price for a given set of dimension values.

price: UsageBasedRateCreateDimensionalUsageBasedRateRequestPricingMatrixCellPrice

The price for the cell.

Accepts one of the following:
class FlatPriceInput:

Flat price is a price that linearly scales with the quantity.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
price_type: Optional[Literal["flat"]]
class PackagePriceInput:

Package price is a price that is charged for a fixed number of units. For example, $10 per 1000 units. If the quantity is not a multiple of the package units, the rounding behavior will be applied.

amount: AmountInput
currency_code: str

The currency code of the amount.

value: Union[float, str]

The value of the amount in the smallest unit of the currency.

Accepts one of the following:
float
str
package_units: int
rounding_behavior: Literal["round_up", "round_down"]
Accepts one of the following:
"round_up"
"round_down"
price_type: Optional[Literal["package"]]
pricing_metric_id: str

The ID of the pricing metric to use for this rate.

usage_based_rate_type: Literal["dimensional"]
description: Optional[str]

The description of the rate displayed to the customer.

included_units: Optional[int]

The number of units included in the rate before the price is applied.

minimum0
ReturnsExpand Collapse
class RateCatalogAddRatesResponse:
id: str
description: str
name: str
rate_count: int
Add Rates To Rate Catalog
import os
from lark import Lark

client = Lark(
    api_key=os.environ.get("LARK_API_KEY"),  # This is the default and can be omitted
)
response = client.rate_catalogs.add_rates(
    rate_catalog_id="rate_catalog_id",
    billing_interval="monthly",
)
print(response.id)
{
  "id": "rate_catalog_AJWMxR81jxoRlli6p13uf3JB",
  "description": "Rates for EC2 usage",
  "name": "EC2 Rates",
  "rate_count": 5
}
Returns Examples
{
  "id": "rate_catalog_AJWMxR81jxoRlli6p13uf3JB",
  "description": "Rates for EC2 usage",
  "name": "EC2 Rates",
  "rate_count": 5
}