Skip to content
Docs

    Billing

    Get Organization Billing Summary
    client.Organizations.Billing.Summary(ctx, organizationID) (*OrganizationBillingSummary, error)
    GET/v1/organizations/{organization_id}/billing/summary
    Get Organization Daily Cost
    client.Organizations.Billing.Cost(ctx, organizationID, query) (*OrganizationDailyCost, error)
    GET/v1/organizations/{organization_id}/billing/cost
    List Organization Billing History
    client.Organizations.Billing.History(ctx, organizationID, query) (*BillingHistoryEntryList, error)
    GET/v1/organizations/{organization_id}/billing/history
    Top Up Organization Prepaid Balance
    client.Organizations.Billing.TopUp(ctx, organizationID, params) (*OrganizationBillingSummary, error)
    POST/v1/organizations/{organization_id}/billing/topup
    Re-trigger Organization Prepaid Recharge
    client.Organizations.Billing.Recharge(ctx, organizationID, body) (*OrganizationBillingSummary, error)
    POST/v1/organizations/{organization_id}/billing/recharge
    Get Organization Usage Statement
    client.Organizations.Billing.Statements(ctx, organizationID, query) (*OrganizationUsageStatement, error)
    GET/v1/organizations/{organization_id}/billing/statements
    ModelsExpand Collapse
    type BillingHistoryEntry struct{…}

    A single billing history line item: a prepaid credit or a manual adjustment.

    ID string

    Unique identifier for the entry.

    Amount string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    CreatedAt Time

    When the entry was recorded.

    formatdate-time
    Currency string

    ISO 4217 currency code.

    Kind of entry.

    One of the following:
    const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"
    const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"
    Description stringOptional

    Human-readable note describing the entry, when available.

    FundingPurpose BillingHistoryEntryFundingPurposeOptional

    Funding flow that produced this entry, for a grant: “first_charge”, “auto_recharge”, “manual_top_up”, or “manual_recharge”. Null for adjustments.

    One of the following:
    const BillingHistoryEntryFundingPurposeFirstCharge BillingHistoryEntryFundingPurpose = "first_charge"
    const BillingHistoryEntryFundingPurposeAutoRecharge BillingHistoryEntryFundingPurpose = "auto_recharge"
    const BillingHistoryEntryFundingPurposeManualTopUp BillingHistoryEntryFundingPurpose = "manual_top_up"
    const BillingHistoryEntryFundingPurposeManualRecharge BillingHistoryEntryFundingPurpose = "manual_recharge"
    ReceiptURL stringOptional

    Link to the hosted receipt for the payment behind this entry, when one is available. Present for prepaid credits funded by a card charge; absent for manual adjustments and while a payment’s receipt is still being finalized.

    type BillingHistoryEntryList struct{…}
    ID string

    Unique identifier for the entry.

    Amount string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    CreatedAt Time

    When the entry was recorded.

    formatdate-time
    Currency string

    ISO 4217 currency code.

    Kind of entry.

    One of the following:
    const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"
    const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"
    Description stringOptional

    Human-readable note describing the entry, when available.

    FundingPurpose BillingHistoryEntryFundingPurposeOptional

    Funding flow that produced this entry, for a grant: “first_charge”, “auto_recharge”, “manual_top_up”, or “manual_recharge”. Null for adjustments.

    One of the following:
    const BillingHistoryEntryFundingPurposeFirstCharge BillingHistoryEntryFundingPurpose = "first_charge"
    const BillingHistoryEntryFundingPurposeAutoRecharge BillingHistoryEntryFundingPurpose = "auto_recharge"
    const BillingHistoryEntryFundingPurposeManualTopUp BillingHistoryEntryFundingPurpose = "manual_top_up"
    const BillingHistoryEntryFundingPurposeManualRecharge BillingHistoryEntryFundingPurpose = "manual_recharge"
    ReceiptURL stringOptional

    Link to the hosted receipt for the payment behind this entry, when one is available. Present for prepaid credits funded by a card charge; absent for manual adjustments and while a payment’s receipt is still being finalized.

    type BillingHistoryEntryType string

    Kind of entry.

    One of the following:
    const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"
    const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"
    type DailyCostPoint struct{…}

    Total usage cost for a single UTC day.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Date string

    UTC calendar day (YYYY-MM-DD).

    type OrganizationDailyCost struct{…}

    Daily usage cost over a date range: one entry per UTC day (zero on idle days), summing open and closed resources. Suitable for a daily cost bar chart.

    Currency string

    ISO 4217 currency code.

    One entry per UTC day in the range, oldest first.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Date string

    UTC calendar day (YYYY-MM-DD).

    From string

    Inclusive start of the range, as a UTC calendar day (YYYY-MM-DD).

    To string

    Inclusive end of the range, as a UTC calendar day (YYYY-MM-DD).

    type OrganizationUsageStatement struct{…}

    Itemized usage statement for a billing month: consumption grouped by project, resource type, and dimension. Costs are recorded at consumption time, not re-priced.

    Currency string

    ISO 4217 currency code.

    Month string

    Billing month the statement covers, as YYYY-MM (UTC).

    Projects []StatementProject

    One entry per project with consumption in the month, ordered by name.

    ProjectID string

    Project identifier.

    ProjectName string

    Human-readable project name.

    ResourceTypes []StatementResourceType

    Consumption grouped by resource type.

    Top-level metered dimensions; a dimension expanded into components carries them in children.

    Component dimensions nested under this one (e.g. vCPU and memory under an instance type). Empty for a leaf.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_vcpu”, “compute_memory_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_n1_standard_8”, “storage_abs_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    ResourceType string

    Resource type the line items belong to (e.g. “vm”, “volume”, “nks_node_pool”).

    Subtotal string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Subtotal string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Total string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    type StatementLineItem struct{…}

    A top-level metered dimension. Heads nest components as children (cost is the subtotal, unit_price null); standalone dimensions carry a unit price and an empty children array.

    Component dimensions nested under this one (e.g. vCPU and memory under an instance type). Empty for a leaf.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_vcpu”, “compute_memory_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_n1_standard_8”, “storage_abs_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    type StatementLineItemLeaf struct{…}

    A priced dimension line: a component nested under a head, or one rate segment of a dimension whose price changed mid-period.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_vcpu”, “compute_memory_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    type StatementProject struct{…}

    A single project’s consumption within a usage statement.

    ProjectID string

    Project identifier.

    ProjectName string

    Human-readable project name.

    ResourceTypes []StatementResourceType

    Consumption grouped by resource type.

    Top-level metered dimensions; a dimension expanded into components carries them in children.

    Component dimensions nested under this one (e.g. vCPU and memory under an instance type). Empty for a leaf.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_vcpu”, “compute_memory_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_n1_standard_8”, “storage_abs_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    ResourceType string

    Resource type the line items belong to (e.g. “vm”, “volume”, “nks_node_pool”).

    Subtotal string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Subtotal string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    type StatementResourceType struct{…}

    Consumption for one resource type within a project (e.g. every VM, every volume).

    Top-level metered dimensions; a dimension expanded into components carries them in children.

    Component dimensions nested under this one (e.g. vCPU and memory under an instance type). Empty for a leaf.

    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_vcpu”, “compute_memory_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Cost string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    Dimension string

    Metered dimension identifier (e.g. “compute_n1_standard_8”, “storage_abs_gb”).

    DisplayName string

    Human-readable label for the dimension.

    QuantityHours string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    UnitPrice stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    ResourceType string

    Resource type the line items belong to (e.g. “vm”, “volume”, “nks_node_pool”).

    Subtotal string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal

    BillingRecharge Policy

    Get Organization Recharge Policy
    client.Organizations.Billing.RechargePolicy.Get(ctx, organizationID) (*OrganizationRechargePolicy, error)
    GET/v1/organizations/{organization_id}/billing/recharge_policy
    Update Organization Recharge Policy
    client.Organizations.Billing.RechargePolicy.Update(ctx, organizationID, body) (*OrganizationRechargePolicy, error)
    PATCH/v1/organizations/{organization_id}/billing/recharge_policy
    ModelsExpand Collapse
    type AutomaticPolicyArgs struct{…}

    PolicyArgs carries the threshold parameters. Required when policy is “automatic”; must be omitted when policy is “manual”.

    Fixed string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    RunwayDays string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    MonthlyCap stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    type OrganizationRechargePolicy struct{…}

    An organization’s current recharge policy. policy_args is null for a manual policy.

    Policy is the top-up mode.

    One of the following:
    const RechargePolicyModeManual RechargePolicyMode = "manual"
    const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"

    PolicyArgs carries the threshold parameters. Required when policy is “automatic”; must be omitted when policy is “manual”.

    Fixed string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    RunwayDays string

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    MonthlyCap stringOptional

    Arbitrary-precision decimal serialized as a string (e.g. “58.40”).

    formatdecimal
    PolicySince Time

    PolicySince is when the policy currently in force took effect. Any change moves it, including an edit to the threshold parameters of an automatic policy.

    formatdate-time
    type RechargePolicyMode string

    Policy is the top-up mode.

    One of the following:
    const RechargePolicyModeManual RechargePolicyMode = "manual"
    const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"