# Billing

## 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.

### Parameters

- `organizationID string`

### Returns

- `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").

  - `EffectiveBalance string`

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

  - `MonthlyCost string`

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

  - `RechargeThresholdDays string`

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

  - `EstimatedNextChargeAt Time`

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

  - `RunwayMonths string`

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

### Example

```go
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)
}
```

#### Response

```json
{
  "daily_cost": "-69125",
  "effective_balance": "-69125",
  "monthly_cost": "-69125",
  "recharge_threshold_days": "-69125",
  "estimated_next_charge_at": "2025-01-01T00:00:00Z",
  "runway_months": "-69125"
}
```

## 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.

### Parameters

- `organizationID string`

- `query BillingCostParams`

  - `From param.Field[Time]`

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

  - `To param.Field[Time]`

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

### Returns

- `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.

  - `Days []DailyCostPoint`

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

    - `Cost string`

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

    - `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).

### Example

```go
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)
}
```

#### Response

```json
{
  "currency": "USD",
  "days": [
    {
      "cost": "-69125",
      "date": "2026-07-07"
    }
  ],
  "from": "2026-06-08",
  "to": "2026-07-08"
}
```

## List Organization Billing History

`client.Organizations.Billing.History(ctx, organizationID, query) (*BillingHistoryEntryList, error)`

**get** `/v1/organizations/{organization_id}/billing/history`

List the organization's billing history: prepaid credits, top-ups, and manual adjustments, newest first. Paginated with an opaque cursor.

### Parameters

- `organizationID string`

- `query BillingHistoryParams`

  - `Cursor param.Field[string]`

    Pagination cursor returned by a previous request

  - `Limit param.Field[int64]`

    Maximum number of items to return

### Returns

- `type BillingHistoryEntryList struct{…}`

  - `Items []BillingHistoryEntry`

    - `ID string`

      Unique identifier for the entry.

    - `Amount string`

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

    - `CreatedAt Time`

      When the entry was recorded.

    - `Currency string`

      ISO 4217 currency code.

    - `Type BillingHistoryEntryType`

      Kind of entry.

      - `const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"`

      - `const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"`

    - `Description string`

      Human-readable note describing the entry, when available.

    - `FundingPurpose BillingHistoryEntryFundingPurpose`

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

      - `const BillingHistoryEntryFundingPurposeFirstCharge BillingHistoryEntryFundingPurpose = "first_charge"`

      - `const BillingHistoryEntryFundingPurposeAutoRecharge BillingHistoryEntryFundingPurpose = "auto_recharge"`

      - `const BillingHistoryEntryFundingPurposeManualTopUp BillingHistoryEntryFundingPurpose = "manual_top_up"`

      - `const BillingHistoryEntryFundingPurposeManualRecharge BillingHistoryEntryFundingPurpose = "manual_recharge"`

    - `ReceiptURL string`

      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.

  - `Pagination Pagination`

    Pagination response details.

    - `NextCursor string`

    - `PreviousCursor string`

    - `TotalCount int64`

### Example

```go
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"),
  )
  billingHistoryEntryList, err := client.Organizations.Billing.History(
    context.TODO(),
    "organization_id",
    organizations.BillingHistoryParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", billingHistoryEntryList.Items)
}
```

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "amount": "-69125",
      "created_at": "2025-01-01T00:00:00Z",
      "currency": "USD",
      "type": "grant",
      "description": "Refund adjustment",
      "funding_purpose": "auto_recharge",
      "receipt_url": "https://pay.stripe.com/receipts/..."
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Top Up Organization Prepaid Balance

`client.Organizations.Billing.TopUp(ctx, organizationID, params) (*OrganizationBillingSummary, error)`

**post** `/v1/organizations/{organization_id}/billing/topup`

Charge the card on file and credit the prepaid balance. A unique Idempotency-Key header is required; reuse it across retries so a timed-out top-up is not charged twice.

### Parameters

- `organizationID string`

- `params BillingTopUpParams`

  - `Amount param.Field[string]`

    Body param: Amount to charge and credit, in USD. Must be greater than 0, at most two decimal places, and at most 10000.

  - `IdempotencyKey param.Field[string]`

    Header param: Unique idempotency key scoping the charge; reuse the same value across retries so a timed-out top-up is not charged twice

### Returns

- `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").

  - `EffectiveBalance string`

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

  - `MonthlyCost string`

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

  - `RechargeThresholdDays string`

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

  - `EstimatedNextChargeAt Time`

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

  - `RunwayMonths string`

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

### Example

```go
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"),
  )
  organizationBillingSummary, err := client.Organizations.Billing.TopUp(
    context.TODO(),
    "organization_id",
    organizations.BillingTopUpParams{
      Amount: "50.00",
      IdempotencyKey: "Idempotency-Key",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationBillingSummary.DailyCost)
}
```

#### Response

```json
{
  "daily_cost": "-69125",
  "effective_balance": "-69125",
  "monthly_cost": "-69125",
  "recharge_threshold_days": "-69125",
  "estimated_next_charge_at": "2025-01-01T00:00:00Z",
  "runway_months": "-69125"
}
```

## Re-trigger Organization Prepaid Recharge

`client.Organizations.Billing.Recharge(ctx, organizationID, body) (*OrganizationBillingSummary, error)`

**post** `/v1/organizations/{organization_id}/billing/recharge`

Charge the card on file up to the recharge target now instead of waiting for the scheduled retry. Automatic-policy prepaid organizations only. Idempotency-Key header required.

### Parameters

- `organizationID string`

- `body BillingRechargeParams`

  - `IdempotencyKey param.Field[string]`

    Idempotency key scoping one charge attempt; reuse to retry it, but use a fresh key for a new attempt (e.g. after updating a declined card)

### Returns

- `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").

  - `EffectiveBalance string`

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

  - `MonthlyCost string`

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

  - `RechargeThresholdDays string`

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

  - `EstimatedNextChargeAt Time`

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

  - `RunwayMonths string`

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

### Example

```go
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"),
  )
  organizationBillingSummary, err := client.Organizations.Billing.Recharge(
    context.TODO(),
    "organization_id",
    organizations.BillingRechargeParams{
      IdempotencyKey: "Idempotency-Key",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationBillingSummary.DailyCost)
}
```

#### Response

```json
{
  "daily_cost": "-69125",
  "effective_balance": "-69125",
  "monthly_cost": "-69125",
  "recharge_threshold_days": "-69125",
  "estimated_next_charge_at": "2025-01-01T00:00:00Z",
  "runway_months": "-69125"
}
```

## 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.

### Parameters

- `organizationID string`

- `query BillingStatementsParams`

  - `Month param.Field[string]`

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

### Returns

- `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.

      - `Items []StatementLineItem`

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

        - `Children []StatementLineItemLeaf`

          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").

          - `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").

          - `UnitPrice string`

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

        - `Cost string`

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

        - `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").

        - `UnitPrice string`

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

      - `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").

    - `Subtotal string`

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

  - `Total string`

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

### Example

```go
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)
}
```

#### Response

```json
{
  "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"
}
```

## Domain Types

### Billing History Entry

- `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").

  - `CreatedAt Time`

    When the entry was recorded.

  - `Currency string`

    ISO 4217 currency code.

  - `Type BillingHistoryEntryType`

    Kind of entry.

    - `const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"`

    - `const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"`

  - `Description string`

    Human-readable note describing the entry, when available.

  - `FundingPurpose BillingHistoryEntryFundingPurpose`

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

    - `const BillingHistoryEntryFundingPurposeFirstCharge BillingHistoryEntryFundingPurpose = "first_charge"`

    - `const BillingHistoryEntryFundingPurposeAutoRecharge BillingHistoryEntryFundingPurpose = "auto_recharge"`

    - `const BillingHistoryEntryFundingPurposeManualTopUp BillingHistoryEntryFundingPurpose = "manual_top_up"`

    - `const BillingHistoryEntryFundingPurposeManualRecharge BillingHistoryEntryFundingPurpose = "manual_recharge"`

  - `ReceiptURL string`

    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.

### Billing History Entry List

- `type BillingHistoryEntryList struct{…}`

  - `Items []BillingHistoryEntry`

    - `ID string`

      Unique identifier for the entry.

    - `Amount string`

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

    - `CreatedAt Time`

      When the entry was recorded.

    - `Currency string`

      ISO 4217 currency code.

    - `Type BillingHistoryEntryType`

      Kind of entry.

      - `const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"`

      - `const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"`

    - `Description string`

      Human-readable note describing the entry, when available.

    - `FundingPurpose BillingHistoryEntryFundingPurpose`

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

      - `const BillingHistoryEntryFundingPurposeFirstCharge BillingHistoryEntryFundingPurpose = "first_charge"`

      - `const BillingHistoryEntryFundingPurposeAutoRecharge BillingHistoryEntryFundingPurpose = "auto_recharge"`

      - `const BillingHistoryEntryFundingPurposeManualTopUp BillingHistoryEntryFundingPurpose = "manual_top_up"`

      - `const BillingHistoryEntryFundingPurposeManualRecharge BillingHistoryEntryFundingPurpose = "manual_recharge"`

    - `ReceiptURL string`

      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.

  - `Pagination Pagination`

    Pagination response details.

    - `NextCursor string`

    - `PreviousCursor string`

    - `TotalCount int64`

### Billing History Entry Type

- `type BillingHistoryEntryType string`

  Kind of entry.

  - `const BillingHistoryEntryTypeGrant BillingHistoryEntryType = "grant"`

  - `const BillingHistoryEntryTypeAdjustment BillingHistoryEntryType = "adjustment"`

### Daily Cost Point

- `type DailyCostPoint struct{…}`

  Total usage cost for a single UTC day.

  - `Cost string`

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

  - `Date string`

    UTC calendar day (YYYY-MM-DD).

### Organization Daily Cost

- `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.

  - `Days []DailyCostPoint`

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

    - `Cost string`

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

    - `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).

### Organization Usage Statement

- `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.

      - `Items []StatementLineItem`

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

        - `Children []StatementLineItemLeaf`

          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").

          - `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").

          - `UnitPrice string`

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

        - `Cost string`

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

        - `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").

        - `UnitPrice string`

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

      - `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").

    - `Subtotal string`

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

  - `Total string`

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

### Statement Line Item

- `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.

  - `Children []StatementLineItemLeaf`

    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").

    - `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").

    - `UnitPrice string`

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

  - `Cost string`

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

  - `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").

  - `UnitPrice string`

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

### Statement Line Item Leaf

- `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").

  - `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").

  - `UnitPrice string`

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

### Statement Project

- `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.

    - `Items []StatementLineItem`

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

      - `Children []StatementLineItemLeaf`

        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").

        - `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").

        - `UnitPrice string`

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

      - `Cost string`

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

      - `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").

      - `UnitPrice string`

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

    - `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").

  - `Subtotal string`

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

### Statement Resource Type

- `type StatementResourceType struct{…}`

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

  - `Items []StatementLineItem`

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

    - `Children []StatementLineItemLeaf`

      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").

      - `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").

      - `UnitPrice string`

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

    - `Cost string`

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

    - `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").

    - `UnitPrice string`

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

  - `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").

# Recharge Policy

## Get Organization Recharge Policy

`client.Organizations.Billing.RechargePolicy.Get(ctx, organizationID) (*OrganizationRechargePolicy, error)`

**get** `/v1/organizations/{organization_id}/billing/recharge_policy`

Get the organization's recharge configuration: the top-up mode, the fixed and proportional threshold components, and when the current mode took effect.

### Parameters

- `organizationID string`

### Returns

- `type OrganizationRechargePolicy struct{…}`

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

  - `Policy RechargePolicyMode`

    Policy is the top-up mode.

    - `const RechargePolicyModeManual RechargePolicyMode = "manual"`

    - `const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"`

  - `PolicyArgs AutomaticPolicyArgs`

    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").

    - `RunwayDays string`

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

    - `MonthlyCap string`

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

  - `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.

### Example

```go
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"),
  )
  organizationRechargePolicy, err := client.Organizations.Billing.RechargePolicy.Get(context.TODO(), "organization_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationRechargePolicy.Policy)
}
```

#### Response

```json
{
  "policy": "automatic",
  "policy_args": {
    "fixed": "-69125",
    "runway_days": "-69125",
    "monthly_cap": "-69125"
  },
  "policy_since": "2026-07-30T12:00:00Z"
}
```

## Update Organization Recharge Policy

`client.Organizations.Billing.RechargePolicy.Update(ctx, organizationID, body) (*OrganizationRechargePolicy, error)`

**patch** `/v1/organizations/{organization_id}/billing/recharge_policy`

Update the organization's recharge mode: manual for self-serve top-ups, or automatic to charge the card on file at the recharge threshold (fixed and proportional required).

### Parameters

- `organizationID string`

- `body BillingRechargePolicyUpdateParams`

  - `Policy param.Field[RechargePolicyMode]`

    Policy is the top-up mode.

  - `PolicyArgs param.Field[AutomaticPolicyArgs]`

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

### Returns

- `type OrganizationRechargePolicy struct{…}`

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

  - `Policy RechargePolicyMode`

    Policy is the top-up mode.

    - `const RechargePolicyModeManual RechargePolicyMode = "manual"`

    - `const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"`

  - `PolicyArgs AutomaticPolicyArgs`

    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").

    - `RunwayDays string`

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

    - `MonthlyCap string`

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

  - `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.

### Example

```go
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"),
  )
  organizationRechargePolicy, err := client.Organizations.Billing.RechargePolicy.Update(
    context.TODO(),
    "organization_id",
    organizations.BillingRechargePolicyUpdateParams{
      Policy: organizations.RechargePolicyModeAutomatic,
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationRechargePolicy.Policy)
}
```

#### Response

```json
{
  "policy": "automatic",
  "policy_args": {
    "fixed": "-69125",
    "runway_days": "-69125",
    "monthly_cap": "-69125"
  },
  "policy_since": "2026-07-30T12:00:00Z"
}
```

## Domain Types

### Automatic Policy Args

- `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").

  - `RunwayDays string`

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

  - `MonthlyCap string`

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

### Organization Recharge Policy

- `type OrganizationRechargePolicy struct{…}`

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

  - `Policy RechargePolicyMode`

    Policy is the top-up mode.

    - `const RechargePolicyModeManual RechargePolicyMode = "manual"`

    - `const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"`

  - `PolicyArgs AutomaticPolicyArgs`

    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").

    - `RunwayDays string`

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

    - `MonthlyCap string`

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

  - `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.

### Recharge Policy Mode

- `type RechargePolicyMode string`

  Policy is the top-up mode.

  - `const RechargePolicyModeManual RechargePolicyMode = "manual"`

  - `const RechargePolicyModeAutomatic RechargePolicyMode = "automatic"`
