Skip to content
Docs

    Get Organization Usage Statement

    client.Organizations.Billing.Statements(ctx, organizationID, query) (*OrganizationUsageStatement, error)
    GET/v1/organizations/{organization_id}/billing/statements

    Get the itemized monthly usage statement: consumption grouped by project, resource type, and dimension, priced from recorded usage. Defaults to the current month.

    ParametersExpand Collapse
    organizationID string
    query BillingStatementsParams
    Month param.Field[string]Optional

    Billing month, YYYY-MM (UTC). Defaults to the current month.

    ReturnsExpand Collapse
    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

    Get Organization Usage Statement

    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"),
      )
      organizationUsageStatement, err := client.Organizations.Billing.Statements(
        context.TODO(),
        "organization_id",
        organizations.BillingStatementsParams{
    
        },
      )
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", organizationUsageStatement.Currency)
    }
    
    {
      "currency": "USD",
      "month": "2026-07",
      "projects": [
        {
          "project_id": "018f8c1a-1b2c-7d3e-9f4a-5b6c7d8e9f01",
          "project_name": "production",
          "resource_types": [
            {
              "items": [
                {
                  "children": [
                    {
                      "cost": "-69125",
                      "dimension": "compute_vcpu",
                      "display_name": "vCPU (hours)",
                      "quantity_hours": "-69125",
                      "unit_price": "-69125"
                    }
                  ],
                  "cost": "-69125",
                  "dimension": "compute_n1_standard_8",
                  "display_name": "VM (n1-standard-8)",
                  "quantity_hours": "-69125",
                  "unit_price": "-69125"
                }
              ],
              "resource_type": "vm",
              "subtotal": "-69125"
            }
          ],
          "subtotal": "-69125"
        }
      ],
      "total": "-69125"
    }
    Returns Examples
    {
      "currency": "USD",
      "month": "2026-07",
      "projects": [
        {
          "project_id": "018f8c1a-1b2c-7d3e-9f4a-5b6c7d8e9f01",
          "project_name": "production",
          "resource_types": [
            {
              "items": [
                {
                  "children": [
                    {
                      "cost": "-69125",
                      "dimension": "compute_vcpu",
                      "display_name": "vCPU (hours)",
                      "quantity_hours": "-69125",
                      "unit_price": "-69125"
                    }
                  ],
                  "cost": "-69125",
                  "dimension": "compute_n1_standard_8",
                  "display_name": "VM (n1-standard-8)",
                  "quantity_hours": "-69125",
                  "unit_price": "-69125"
                }
              ],
              "resource_type": "vm",
              "subtotal": "-69125"
            }
          ],
          "subtotal": "-69125"
        }
      ],
      "total": "-69125"
    }