Skip to content
Docs

    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.

    ParametersExpand Collapse
    organizationID string
    query BillingHistoryParams
    Cursor param.Field[string]Optional

    Pagination cursor returned by a previous request

    Limit param.Field[int64]Optional

    Maximum number of items to return

    maximum100
    minimum10
    ReturnsExpand Collapse
    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.

    Purpose BillingHistoryEntryPurposeOptional

    Why this entry exists: for a grant, the funding flow (“first_charge”, “auto_recharge”, “manual_top_up”, “manual_recharge”) or “bonus_grant” for credit issued with no payment behind it; for an adjustment, the claw-back reason (“refund”, “dispute”). Null for adjustments with no recorded reason.

    One of the following:
    const BillingHistoryEntryPurposeFirstCharge BillingHistoryEntryPurpose = "first_charge"
    const BillingHistoryEntryPurposeAutoRecharge BillingHistoryEntryPurpose = "auto_recharge"
    const BillingHistoryEntryPurposeManualTopUp BillingHistoryEntryPurpose = "manual_top_up"
    const BillingHistoryEntryPurposeManualRecharge BillingHistoryEntryPurpose = "manual_recharge"
    const BillingHistoryEntryPurposeBonusGrant BillingHistoryEntryPurpose = "bonus_grant"
    const BillingHistoryEntryPurposeRefund BillingHistoryEntryPurpose = "refund"
    const BillingHistoryEntryPurposeDispute BillingHistoryEntryPurpose = "dispute"
    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.

    List Organization Billing History

    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)
    }
    
    {
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "amount": "-69125",
          "created_at": "2025-01-01T00:00:00Z",
          "currency": "USD",
          "type": "grant",
          "description": "Refund adjustment",
          "purpose": "auto_recharge",
          "receipt_url": "https://pay.stripe.com/receipts/..."
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }
    Returns Examples
    {
      "items": [
        {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "amount": "-69125",
          "created_at": "2025-01-01T00:00:00Z",
          "currency": "USD",
          "type": "grant",
          "description": "Refund adjustment",
          "purpose": "auto_recharge",
          "receipt_url": "https://pay.stripe.com/receipts/..."
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }