
Fetching fixed and variable costs for a contract
A contract's costs are made up of billing items, each of which is either:
Fixed (
subscription) — a periodic charge independent of usageVariable (
consumption) — a usage-based charge tied to a unit of measure, billed per Gj/kWh/m³/...
The model chain is:
Contract
└─ BillingDetails.Products[] (per-period product references)
└─ Product.BillingItems[] (billing items attached to the product)
└─ BillingItem.CalculationParameters ("subscription" = fixed | "consumption" = variable)└─ BillingTariff (the € amount — UnitTariff)
Steps
Step 1 — Get the contract
GET /api/md/contracts/{contractUuid}API documentation
Returns a ContractDTO.
The field you need:
BillingDetails.Products[]
Take every (currently active, or period-relevant) ProductId from BillingDetails.Products[] into step 2.
Step 2 — Get each product's billing items
GET /api/cfg/products/{productUuid}API documentation
Returns a ProductDTO with BillingItems[] (ProductBillingItemDTO) — each entry gives you a BillingItemId plus its PeriodicityParameters.
Collect every BillingItemId.
Step 3 — Get each billing item (fixed vs. variable happens here)
GET /api/cfg/billingitems/{billingItemUuid}API documentation
Returns a BillingItemDTO with Name, Description, and a polymorphic CalculationParameters, discriminated by JSON "type".
Bucket each billing item as fixed (type: "subscription") or variable (type: "consumption") based on this field.
Step 4 — Get the tariff (the € amount)
GET /api/cfg/billingtariffs?productId={productUuid}&billingItemId={billingItemUuid}API documentation
Returns BillingTariffDTO[] with a polymorphic CalculationParameters.
The common case is:
{
"id": "c412...",
"productId": "...",
"billingItemId": "b1a7...",
"contractId": null,
"startDateTime": "2026-01-01T00:00:00Z",
"endDateTime": null,
"calculationParameters": {
"type": "unitPrice",
"unitTariff": 32.80
}
}unitTariff is the € amount per unit — per year for a subscription billing item, per unit of measure (e.g. per Gj) for a consumption billing item.
Tariffs can be contract-specific: if a tariff's contractId matches your contract, prefer it over a generic product-level tariff (contractId: null) for the same billing item.
Other calculation types exist besides unitPrice — tiered, volume, stairStep, condition — each with its own parameter shape in the same response family. Handle unitPrice first; the others are needed only if the contract uses tiered/volume-based pricing.