Skip to main content

Documentation Index

Fetch the complete documentation index at: https://alguna.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

When creating or viewing subscription items, each item has a price object containing a type field that determines which pricing model is used. Exactly one pricing model field will be populated, matching the type.

Supported Pricing Types

TypeFee TypeModel FieldDescription
unitmeteredunit_pricing_modelSimple per-unit rate
fixedfixedfixed_pricing_modelFlat amount for a fixed quantity
tieredmeteredtiered_pricing_modelTotal usage determines the tier; all units priced at that tier’s rate
graduated_tieredmeteredgraduated_tiered_pricing_modelEach tier priced independently (units 0-100 at rate A, 101-500 at rate B)
tiered_percentagemeteredtiered_percentage_pricing_modelPercentage-based tiers (first matching tier applies)
graduated_percentagemeteredgraduated_percentage_pricing_modelGraduated percentage tiers (each tier priced independently)
volume_percentagemeteredvolume_percentage_pricing_modelPercentage of transaction volume with base rate
prepaid_tieredmeteredprepaid_tiered_pricing_modelPre-purchased units with tiered overage rates
prepaid_fixed_tieredmeteredprepaid_fixed_tiered_pricing_modelPre-purchased units with tiered overages and configurable overage interval
expressionmeteredexpression_pricing_modelCustom expression-based pricing

Common Fields

Every price includes these fields alongside the model-specific field:
FieldTypeRequiredDescription
typestringYesOne of the 10 pricing types above
billing_intervalstringYesmonthly, quarterly, semi_annual, or yearly
fee_typestringYesfixed or metered
billing_directionstringYesadvance (start of period) or arrears (end of period)
billing_frequencystringNorecurring or one-off. Required for fixed fee type
metric_idsstring[]ConditionalRequired for metered fee type. Which metrics drive usage
display_orderintegerNoSort order for display
charge_on_contract_startbooleanNoFor one-off prices: charge on contract start instead of first billing date
trial_period_daysintegerNoDays before billing starts (minimum 1)
discountobjectNoPrice-level discount
minimum_spendobjectNoFloor spend per period ({ "amount": "500.00", "period": "monthly" })
maximum_spendobjectNoCeiling spend per period ({ "amount": "5000.00", "period": "monthly" })
When creating prices, currency is inherited from the subscription and should not be specified. In responses, currency is always included.

Pricing Model Examples

Unit Pricing

Simple per-unit rate. Best for metered products where each unit costs the same.
{
  "type": "unit",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_api_calls"],
  "unit_pricing_model": {
    "price_per_unit": "0.05"
  }
}

Fixed Pricing

Flat amount for a fixed quantity of units. total is computed server-side (not required in requests).
{
  "type": "fixed",
  "billing_interval": "monthly",
  "fee_type": "fixed",
  "billing_direction": "arrears",
  "billing_frequency": "recurring",
  "fixed_pricing_model": {
    "price_per_unit": "500.00",
    "units": 1
  }
}
In responses, the total field is included:
"fixed_pricing_model": {
  "price_per_unit": "500.00",
  "units": 1,
  "total": "500.00"
}

Tiered Pricing

Total usage determines which tier applies. All units are priced at that single tier’s rate.
{
  "type": "tiered",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_api_calls"],
  "tiered_pricing_model": {
    "tiers": [
      { "min_units": 0, "max_units": 1000, "price_per_unit": "0.20", "fixed_fee": null },
      { "min_units": 1001, "max_units": 10000, "price_per_unit": "0.15", "fixed_fee": null },
      { "min_units": 10001, "max_units": null, "price_per_unit": "0.10", "fixed_fee": null }
    ]
  }
}

Graduated Tiered Pricing

Each tier is priced independently. Units 0-1000 at 0.20,units100110000at0.20, units 1001-10000 at 0.15, etc.
{
  "type": "graduated_tiered",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_api_calls"],
  "graduated_tiered_pricing_model": {
    "tiers": [
      { "min_units": 0, "max_units": 1000, "price_per_unit": "0.20", "fixed_fee": null },
      { "min_units": 1001, "max_units": 10000, "price_per_unit": "0.15", "fixed_fee": null },
      { "min_units": 10001, "max_units": null, "price_per_unit": "0.10", "fixed_fee": null }
    ]
  }
}

Tiered Percentage Pricing

Percentage-based tiers. Total usage determines which tier’s percentage applies to all units.
{
  "type": "tiered_percentage",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_revenue"],
  "tiered_percentage_pricing_model": {
    "tiers": [
      { "min_units": 0, "max_units": 100000, "percentage": "2.9", "fixed_fee": "0.30" },
      { "min_units": 100001, "max_units": null, "percentage": "1.5", "fixed_fee": null }
    ]
  }
}

Graduated Percentage Pricing

Each tier’s percentage applies independently to the units within that tier.
{
  "type": "graduated_percentage",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_revenue"],
  "graduated_percentage_pricing_model": {
    "tiers": [
      { "min_units": 0, "max_units": 100000, "percentage": "2.9", "fixed_fee": "0.30" },
      { "min_units": 100001, "max_units": null, "percentage": "1.5", "fixed_fee": null }
    ]
  }
}

Volume Percentage Pricing

Charges a percentage of transaction volume plus an optional fixed fee per transaction.
{
  "type": "volume_percentage",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_payments"],
  "volume_percentage_pricing_model": {
    "price_per_unit": "0.00",
    "percentage": "2.9",
    "fixed_fee": "0.30"
  }
}

Prepaid Tiered Pricing

Customer pre-purchases a block of units. Overages are charged at tiered rates.
{
  "type": "prepaid_tiered",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_api_calls"],
  "prepaid_tiered_pricing_model": {
    "prepaid_units": 50000,
    "tiers": [
      { "min_units": 0, "max_units": 10000, "price_per_unit": "0.02", "fixed_fee": null },
      { "min_units": 10001, "max_units": null, "price_per_unit": "0.01", "fixed_fee": null }
    ]
  }
}

Prepaid Fixed Tiered Pricing

Like prepaid tiered, but with a configurable overage charge interval.
{
  "type": "prepaid_fixed_tiered",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_api_calls"],
  "prepaid_fixed_tiered_pricing_model": {
    "prepaid_units": 50000,
    "overages_charge_interval": "monthly",
    "tiers": [
      { "min_units": 0, "max_units": 10000, "price_per_unit": "0.02", "fixed_fee": null },
      { "min_units": 10001, "max_units": null, "price_per_unit": "0.01", "fixed_fee": null }
    ]
  }
}

Expression Pricing

Custom expression-based pricing. Supports arbitrary formulas for quantity and unit price.
{
  "type": "expression",
  "billing_interval": "monthly",
  "fee_type": "metered",
  "billing_direction": "arrears",
  "metric_ids": ["met_compute_hours"],
  "expression_pricing_model": {
    "charges": [
      {
        "billing_direction": "charge",
        "description": "Compute usage charge",
        "quantity_expression": "usage.compute_hours",
        "unit_price_expression": "0.01 * (1 - min(usage.compute_hours / 100000, 0.5))"
      }
    ]
  }
}

Discounts

Price-level discounts support both percentage and fixed types:
"discount": {
  "type": "percentage",
  "amount": "20",
  "duration_type": "fixed",
  "duration_value": 3,
  "duration_unit": "months"
}
FieldTypeRequiredDescription
typestringYespercentage or fixed
amountstringYesDiscount amount (percentage value or fixed amount)
duration_typestringYesfixed, rolling, or perpetual
duration_valueintegerConditionalRequired when duration_type is fixed
duration_unitstringConditionalRequired when duration_type is fixed. Values: days, weeks, months, years
Subscription-level discounts (set via PATCH) only support percentage type. Price-level discounts support both types.

Spending Thresholds

Both minimum_spend and maximum_spend use the same structure:
{
  "amount": "500.00",
  "period": "monthly"
}
FieldTypeRequiredDescription
amountstringYesThreshold amount (must be greater than 0)
periodstringYesBilling period: monthly, quarterly, semi_annual, or yearly

Tier Structure

Standard Tiers (unit-based pricing models)

Used by tiered, graduated_tiered, prepaid_tiered, and prepaid_fixed_tiered models:
FieldTypeRequiredDescription
min_unitsintegerYesLower bound of the tier (inclusive)
max_unitsintegerNoUpper bound (null = unlimited)
price_per_unitstringNoPrice charged per unit in this tier
fixed_feestringNoFixed fee charged when this tier is active

Percentage Tiers

Used by tiered_percentage and graduated_percentage models:
FieldTypeRequiredDescription
min_unitsintegerYesLower bound of the tier (inclusive)
max_unitsintegerNoUpper bound (null = unlimited)
percentagestringNoPercentage rate applied in this tier
fixed_feestringNoFixed fee charged when this tier is active