Skip to content
DocsOpenAPI spec

    Get Organization Billing Summary

    client.Organizations.Billing.Summary(ctx, organizationID) (*OrganizationBillingSummary, error)
    GET/v1/organizations/{organization_id}/billing/summary

    Get the organization’s billing summary: effective balance, monthly and daily run-rate cost, runway, and the projected next-recharge date. Costs are run-rate projections.

    ParametersExpand Collapse
    organizationID string
    ReturnsExpand Collapse
    type OrganizationBillingSummary struct{…}

    Forward-looking billing summary for an organization. All costs are run-rate projections from the organization’s current active usage (”≈ $X/mo at current usage”).

    DailyCost string

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

    formatdecimal
    EffectiveBalance string

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

    formatdecimal
    MonthlyCost string

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

    formatdecimal
    PromotionalCredits []OrganizationBillingSummaryPromotionalCredit

    Credits the organization earns automatically through the startup credits program, one per step. Empty when the organization is not part of the program.

    Amount string

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

    formatdecimal
    Kind string

    Step that earns the credit: creating the organization, or saving a payment method on it.

    One of the following:
    const OrganizationBillingSummaryPromotionalCreditKindOrganizationCreated OrganizationBillingSummaryPromotionalCreditKind = "organization_created"
    const OrganizationBillingSummaryPromotionalCreditKindPaymentMethodAdded OrganizationBillingSummaryPromotionalCreditKind = "payment_method_added"
    Status string

    Whether the credit can still be earned (“available”), was earned and is being issued (“pending”), or was issued (“granted”). A granted credit reaches the balance shortly after it is issued.

    One of the following:
    const OrganizationBillingSummaryPromotionalCreditStatusAvailable OrganizationBillingSummaryPromotionalCreditStatus = "available"
    const OrganizationBillingSummaryPromotionalCreditStatusPending OrganizationBillingSummaryPromotionalCreditStatus = "pending"
    const OrganizationBillingSummaryPromotionalCreditStatusGranted OrganizationBillingSummaryPromotionalCreditStatus = "granted"
    RechargeThresholdDays string

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

    formatdecimal
    EstimatedNextChargeAt TimeOptional

    Projected date the balance reaches the recharge threshold at the current run-rate. Null when there is no active usage (never charges).

    formatdate-time
    RunwayMonths stringOptional

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

    formatdecimal

    Get Organization Billing Summary

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      organizationBillingSummary, err := client.Organizations.Billing.Summary(context.TODO(), "organization_id")
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", organizationBillingSummary.DailyCost)
    }
    
    {
      "daily_cost": "-69125",
      "effective_balance": "-69125",
      "monthly_cost": "-69125",
      "promotional_credits": [
        {
          "amount": "-69125",
          "kind": "payment_method_added",
          "status": "available"
        }
      ],
      "recharge_threshold_days": "-69125",
      "estimated_next_charge_at": "2025-01-01T00:00:00Z",
      "runway_months": "-69125"
    }
    Returns Examples
    {
      "daily_cost": "-69125",
      "effective_balance": "-69125",
      "monthly_cost": "-69125",
      "promotional_credits": [
        {
          "amount": "-69125",
          "kind": "payment_method_added",
          "status": "available"
        }
      ],
      "recharge_threshold_days": "-69125",
      "estimated_next_charge_at": "2025-01-01T00:00:00Z",
      "runway_months": "-69125"
    }