Skip to content
Book a demoContact usGet started

Add Rates To Rate Catalog

client.RateCatalogs.AddRates(ctx, rateCatalogID, body) (*RateCatalogAddRatesResponse, error)
post/rate-catalogs/{rate_catalog_id}/add_rates

Add Rates To Rate Catalog

ParametersExpand Collapse
rateCatalogID string
body RateCatalogAddRatesParams
BillingInterval param.Field[RateCatalogAddRatesParamsBillingInterval]

How often the customer will be billed for these rates.

const RateCatalogAddRatesParamsBillingIntervalMonthly RateCatalogAddRatesParamsBillingInterval = "monthly"
const RateCatalogAddRatesParamsBillingIntervalYearly RateCatalogAddRatesParamsBillingInterval = "yearly"
FixedRates param.Field[[]RateCatalogAddRatesParamsFixedRate]optional

The fixed rate to create in the catalog.

Code string

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

Name string

The name of the rate displayed to the customer.

Price RateCatalogAddRatesParamsFixedRatePriceUnion

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

Accepts one of the following:
type FlatPriceInput struct{…}

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

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PriceType FlatPriceInputPriceTypeoptional
type PackagePriceInput struct{…}

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.

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PackageUnits int64
RoundingBehavior PackagePriceInputRoundingBehavior
Accepts one of the following:
const PackagePriceInputRoundingBehaviorRoundUp PackagePriceInputRoundingBehavior = "round_up"
const PackagePriceInputRoundingBehaviorRoundDown PackagePriceInputRoundingBehavior = "round_down"
PriceType PackagePriceInputPriceTypeoptional
Description stringoptional

The description of the rate displayed to the customer.

UsageBasedRates param.Field[[]RateCatalogAddRatesParamsUsageBasedRateUnion]optional

The usage based rates to create in the catalog.

type RateCatalogAddRatesParamsUsageBasedRateSimple struct{…}
Code string

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

Name string

The name of the rate displayed to the customer.

Price RateCatalogAddRatesParamsUsageBasedRateSimplePriceUnion

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

Accepts one of the following:
type FlatPriceInput struct{…}

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

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PriceType FlatPriceInputPriceTypeoptional
type PackagePriceInput struct{…}

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.

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PackageUnits int64
RoundingBehavior PackagePriceInputRoundingBehavior
Accepts one of the following:
const PackagePriceInputRoundingBehaviorRoundUp PackagePriceInputRoundingBehavior = "round_up"
const PackagePriceInputRoundingBehaviorRoundDown PackagePriceInputRoundingBehavior = "round_down"
PriceType PackagePriceInputPriceTypeoptional
PricingMetricID string

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

UsageBasedRateType Simple
Description stringoptional

The description of the rate displayed to the customer.

IncludedUnits int64optional

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

minimum0
type RateCatalogAddRatesParamsUsageBasedRateDimensional struct{…}
Code string

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

Dimensions []RateCatalogAddRatesParamsUsageBasedRateDimensionalDimension

The dimensions of the rate.

Key string

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

Values []string

A list of possible values for the dimension.

Description stringoptional

The description of the dimension.

Name string

The name of the rate displayed to the customer.

PricingMatrix RateCatalogAddRatesParamsUsageBasedRateDimensionalPricingMatrix

The pricing matrix of the rate.

Cells []RateCatalogAddRatesParamsUsageBasedRateDimensionalPricingMatrixCell
DimensionCoordinates map[string, string]

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

Price RateCatalogAddRatesParamsUsageBasedRateDimensionalPricingMatrixCellPriceUnion

The price for the cell.

Accepts one of the following:
type FlatPriceInput struct{…}

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

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PriceType FlatPriceInputPriceTypeoptional
type PackagePriceInput struct{…}

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.

CurrencyCode string

The currency code of the amount.

Value AmountInputValueUnion

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

Accepts one of the following:
float64
string
PackageUnits int64
RoundingBehavior PackagePriceInputRoundingBehavior
Accepts one of the following:
const PackagePriceInputRoundingBehaviorRoundUp PackagePriceInputRoundingBehavior = "round_up"
const PackagePriceInputRoundingBehaviorRoundDown PackagePriceInputRoundingBehavior = "round_down"
PriceType PackagePriceInputPriceTypeoptional
PricingMetricID string

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

UsageBasedRateType Dimensional
Description stringoptional

The description of the rate displayed to the customer.

IncludedUnits int64optional

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

minimum0
ReturnsExpand Collapse
type RateCatalogAddRatesResponse struct{…}
ID string
Description string
Name string
RateCount int64
Add Rates To Rate Catalog
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/lark-go"
  "github.com/stainless-sdks/lark-go/option"
)

func main() {
  client := lark.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.RateCatalogs.AddRates(
    context.TODO(),
    "rate_catalog_id",
    lark.RateCatalogAddRatesParams{
      BillingInterval: lark.RateCatalogAddRatesParamsBillingIntervalMonthly,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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
}