## Get Organization Usage

`client.Organizations.GetUsage(ctx, organizationID, query) (*UsageAndPlan, error)`

**get** `/api/v1/organizations/{organization_id}/usage`

Get usage for a specific organization.

### Parameters

- `organizationID string`

- `query OrganizationGetUsageParams`

  - `GetCurrentInvoiceTotal param.Field[bool]`

### Returns

- `type UsageAndPlan struct{…}`

  - `Plan UsageAndPlanPlan`

    - `Limits UsageAndPlanPlanLimits`

      - `AllowPayAsYouGo bool`

        Whether usage is allowed after credit grants are exhausted

      - `MaxConcurrentIndexJobs int64`

      - `MaxConcurrentParseJobsOther int64`

      - `MaxConcurrentParseJobsPremium int64`

      - `MaxDataSinks int64`

      - `MaxDataSources int64`

      - `MaxEmbeddingModels int64`

      - `MaxExtractionAgents int64`

      - `MaxExtractionJobs int64`

      - `MaxExtractionRuns int64`

      - `MaxFilesPerIndex int64`

      - `MaxIndexes int64`

      - `MaxMonthlyInvoiceTotalUsd int64`

      - `MaxOrganizations int64`

      - `MaxPagesPerIndex int64`

      - `MaxProjects int64`

      - `MaxPublishedAgents int64`

      - `MaxReportAgentSessions int64`

      - `MaxUsers int64`

      - `MfaEnabled bool`

      - `SSOEnabled bool`

      - `SubscriptionCostUsd int64`

      - `MaxDirectories int64`

      - `MaxDirectoryFilesPerDirectory int64`

      - `MaxDirectoryIngestFiles int64`

      - `MaxDirectorySyncPlanActions int64`

      - `SpendingSoftAlertsUsdCents []int64`

        The amount of USD cents at which a soft alert should be triggered

    - `Name string`

      - `const UsageAndPlanPlanNameEnterprise UsageAndPlanPlanName = "enterprise"`

      - `const UsageAndPlanPlanNameEnterpriseContract UsageAndPlanPlanName = "enterprise_contract"`

      - `const UsageAndPlanPlanNameEnterprisePoc UsageAndPlanPlanName = "enterprise_poc"`

      - `const UsageAndPlanPlanNameFree UsageAndPlanPlanName = "free"`

      - `const UsageAndPlanPlanNameFreeContract UsageAndPlanPlanName = "free_contract"`

      - `const UsageAndPlanPlanNameFreeV1 UsageAndPlanPlanName = "free_v1"`

      - `const UsageAndPlanPlanNameFreeV2 UsageAndPlanPlanName = "free_v2"`

      - `const UsageAndPlanPlanNameLlamaParse UsageAndPlanPlanName = "llama_parse"`

      - `const UsageAndPlanPlanNamePro UsageAndPlanPlanName = "pro"`

      - `const UsageAndPlanPlanNameProV1 UsageAndPlanPlanName = "pro_v1"`

      - `const UsageAndPlanPlanNameProV2 UsageAndPlanPlanName = "pro_v2"`

      - `const UsageAndPlanPlanNameStarterV1 UsageAndPlanPlanName = "starter_v1"`

      - `const UsageAndPlanPlanNameStarterV2 UsageAndPlanPlanName = "starter_v2"`

      - `const UsageAndPlanPlanNameUnknown UsageAndPlanPlanName = "unknown"`

      - `const UsageAndPlanPlanNameYcDealV1 UsageAndPlanPlanName = "yc_deal_v1"`

    - `PlanFrequency string`

      - `const UsageAndPlanPlanPlanFrequencyAnnual UsageAndPlanPlanPlanFrequency = "ANNUAL"`

      - `const UsageAndPlanPlanPlanFrequencyMonthly UsageAndPlanPlanPlanFrequency = "MONTHLY"`

      - `const UsageAndPlanPlanPlanFrequencyQuarterly UsageAndPlanPlanPlanFrequency = "QUARTERLY"`

    - `ID string`

      The ID of the plan in Metronome

    - `CurrentBillingPeriod UsageAndPlanPlanCurrentBillingPeriod`

      The current billing period

      - `EndDate Time`

      - `StartDate Time`

    - `EndingBefore Time`

      The date the plan ends on

    - `FailureCount int64`

      The number of payment failures for this organization

    - `IsPaymentFailed bool`

      Whether the organization has a failed payment that requires support contact

    - `RecurringCredits []UsageAndPlanPlanRecurringCredit`

      - `CreditAmount int64`

      - `CreditType UsageAndPlanPlanRecurringCreditCreditType`

        - `ID string`

        - `Name string`

      - `Name string`

      - `Priority float64`

      - `ProductID string`

        The ID of the product in Metronome used to represent the credit grant

      - `RolloverFraction float64`

        The fraction of the credit that will roll over to the next period, between 0 and 1

      - `PeriodsDuration float64`

        How many billing periods the credit grant will last for

    - `StartingOn Time`

      The date the plan starts on

  - `Usage UsageAndPlanUsage`

    Account usage totals shown alongside the plan.

    - `ActiveAlerts []string`

      - `const UsageAndPlanUsageActiveAlertConfiguredSpendLimitExceeded UsageAndPlanUsageActiveAlert = "configured_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertFreeCreditsExhausted UsageAndPlanUsageActiveAlert = "free_credits_exhausted"`

      - `const UsageAndPlanUsageActiveAlertHasSpendingAlert UsageAndPlanUsageActiveAlert = "has_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertInternalSpendingAlert UsageAndPlanUsageActiveAlert = "internal_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitExceeded UsageAndPlanUsageActiveAlert = "plan_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitSoftAlert UsageAndPlanUsageActiveAlert = "plan_spend_limit_soft_alert"`

    - `ActiveFreeCreditsUsage []UsageAndPlanUsageActiveFreeCreditsUsage`

      - `ExpiresAt Time`

      - `GrantName string`

      - `RemainingBalance int64`

      - `StartingBalance int64`

    - `CurrentInvoiceTotalUsdCents int64`

    - `TotalExtractionAgents int64`

    - `TotalIndexedPages int64`

    - `TotalIndexes int64`

    - `TotalUsers int64`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  usageAndPlan, err := client.Organizations.GetUsage(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationGetUsageParams{

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

#### Response

```json
{
  "plan": {
    "limits": {
      "allow_pay_as_you_go": true,
      "max_concurrent_index_jobs": 0,
      "max_concurrent_parse_jobs_other": 0,
      "max_concurrent_parse_jobs_premium": 0,
      "max_data_sinks": 0,
      "max_data_sources": 0,
      "max_embedding_models": 0,
      "max_extraction_agents": 0,
      "max_extraction_jobs": 0,
      "max_extraction_runs": 0,
      "max_files_per_index": 0,
      "max_indexes": 0,
      "max_monthly_invoice_total_usd": 0,
      "max_organizations": 0,
      "max_pages_per_index": 0,
      "max_projects": 0,
      "max_published_agents": 0,
      "max_report_agent_sessions": 0,
      "max_users": 0,
      "mfa_enabled": true,
      "sso_enabled": true,
      "subscription_cost_usd": 0,
      "max_directories": 0,
      "max_directory_files_per_directory": 0,
      "max_directory_ingest_files": 0,
      "max_directory_sync_plan_actions": 0,
      "spending_soft_alerts_usd_cents": [
        0
      ]
    },
    "name": "enterprise",
    "plan_frequency": "ANNUAL",
    "id": "id",
    "current_billing_period": {
      "end_date": "2019-12-27T18:11:19.117Z",
      "start_date": "2019-12-27T18:11:19.117Z"
    },
    "ending_before": "2019-12-27T18:11:19.117Z",
    "failure_count": 0,
    "is_payment_failed": true,
    "recurring_credits": [
      {
        "credit_amount": 0,
        "credit_type": {
          "id": "id",
          "name": "name"
        },
        "name": "name",
        "priority": 0,
        "product_id": "product_id",
        "rollover_fraction": 0,
        "periods_duration": 0
      }
    ],
    "starting_on": "2019-12-27T18:11:19.117Z"
  },
  "usage": {
    "active_alerts": [
      "configured_spend_limit_exceeded"
    ],
    "active_free_credits_usage": [
      {
        "expires_at": "2019-12-27T18:11:19.117Z",
        "grant_name": "grant_name",
        "remaining_balance": 0,
        "starting_balance": 0
      }
    ],
    "current_invoice_total_usd_cents": 0,
    "total_extraction_agents": 0,
    "total_indexed_pages": 0,
    "total_indexes": 0,
    "total_users": 0
  }
}
```
