Skip to content
Docs

    Get Organization Daily Cost

    client.Organizations.Billing.Cost(ctx, organizationID, query) (*OrganizationDailyCost, error)
    GET/v1/organizations/{organization_id}/billing/cost

    Get the organization’s total usage cost per UTC day over a date range (max 90 days), summing open and closed resources. One entry per day, oldest first. Defaults to the last 30 days.

    ParametersExpand Collapse
    organizationID string
    query BillingCostParams
    From param.Field[Time]Optional

    Inclusive start day, YYYY-MM-DD (UTC). Defaults to 30 days before to.

    formatdate
    To param.Field[Time]Optional

    Inclusive end day, YYYY-MM-DD (UTC). Defaults to today.

    formatdate
    ReturnsExpand Collapse
    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).

    Get Organization Daily Cost

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
      "github.com/nirvana-labs/nirvana-go/organizations"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      organizationDailyCost, err := client.Organizations.Billing.Cost(
        context.TODO(),
        "organization_id",
        organizations.BillingCostParams{
    
        },
      )
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", organizationDailyCost.Currency)
    }
    
    {
      "currency": "USD",
      "days": [
        {
          "cost": "-69125",
          "date": "2026-07-07"
        }
      ],
      "from": "2026-06-08",
      "to": "2026-07-08"
    }
    Returns Examples
    {
      "currency": "USD",
      "days": [
        {
          "cost": "-69125",
          "date": "2026-07-07"
        }
      ],
      "from": "2026-06-08",
      "to": "2026-07-08"
    }