> ## Documentation Index
> Fetch the complete documentation index at: https://ona.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Cumulative Credit Usage

> Returns cumulative credit usage for an organization and its teams.

`Unary` · [`Billing`](https://ona.com/docs/api-reference/generated/billing/overview)

Returns cumulative credit usage for an organization and its teams.

Use this method to:

* Get the total cumulative credit consumption as of a point in time
* Get per-team cumulative usage with credit allocation (budget) comparison
* Display team credit summaries on the usage page and team detail page
* Display user budget utilization when user budgets are enabled

### Examples

* Get current cumulative usage:

  ```yaml theme={null}
  organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
  ```

* Get cumulative usage as of a specific date:

  ```yaml theme={null}
  organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
  asOf: "2026-03-31T23:59:59Z"
  ```

### Authorization

Requires `billing:read_usage` permission on the organization.

## Endpoint

```text theme={null}
POST /api/gitpod.v1.BillingService/GetCumulativeCreditUsage
```

Send a Bearer token as described in [Authentication](https://ona.com/docs/api-reference.md#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

```bash cURL theme={null}
export ONA_HOST=https://app.ona.com
export ONA_API_KEY=<your-token>

curl --request POST \
  --url "$ONA_HOST/api/gitpod.v1.BillingService/GetCumulativeCreditUsage" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "organizationId": "<organization-id>"
}'
```

```python Python theme={null}
import gitpod.v1.billing_pb2 as billing_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
request = billing_pb2.GetCumulativeCreditUsageRequest(
    organization_id="<organization-id>",
)
response = ona.services.billing.get_cumulative_credit_usage(request)
print(response)
```

```typescript TypeScript theme={null}
import { create } from "@bufbuild/protobuf";
import { createClientFromEnv } from "@gitpod/sdk";
import { GetCumulativeCreditUsageRequestSchema } from "@gitpod/sdk/gitpod/v1/billing_pb";

async function main() {
  const ona = createClientFromEnv();
  const request = create(GetCumulativeCreditUsageRequestSchema, {
    organizationId: "<organization-id>",
  });
  const response = await ona.services.billing.getCumulativeCreditUsage(request);
  console.log(response);
}

main().catch(console.error);
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"connectrpc.com/connect"
	"github.com/gitpod-io/gitpod-sdk-go/sdk"
	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
)

func main() {
	ona, err := sdk.NewFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	request := connect.NewRequest(&gitpodpb.GetCumulativeCreditUsageRequest{
		OrganizationId: "<organization-id>",
	})
	response, err := ona.Services.Billing.GetCumulativeCreditUsage(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

```json Request body theme={null}
{
  "organizationId": "<organization-id>"
}
```

## Request

`gitpod.v1.GetCumulativeCreditUsageRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `organizationId` | string | Yes | organization\_id is the ID of the organization to get cumulative usage for. Constraints: `required=true, string.uuid=true`. |
| `asOf` | RFC 3339 timestamp | No | as\_of is the point in time to compute cumulative usage up to. Defaults to now if not set. |

## Response

`gitpod.v1.GetCumulativeCreditUsageResponse`

| Field | Type | Required | Description |
| - | - | - | - |
| `orgUsage` | [CumulativeCreditUsage](#type-gitpod-v1-cumulative-credit-usage) | No | Org-wide cumulative usage, broken down by type and total. |
| `teamUsage` | array of [TeamCumulativeCreditUsage](#type-gitpod-v1-team-cumulative-credit-usage) | No | Per-team cumulative usage with credit allocation comparison. Returns all teams (no top-N limit). |
| `unteamedUsage` | [CumulativeCreditUsage](#type-gitpod-v1-cumulative-credit-usage) | No | Usage by members not assigned to any team. |
| `periodStart` | RFC 3339 timestamp | No | Start of the cumulative calculation period. Cumulative totals are computed from this date forward. |
| `userUsage` | array of [UserCreditBudgetUsage](#type-gitpod-v1-user-credit-budget-usage) | No | Per-user month-to-date usage for every user with usage in the period. The budget fields on each entry are populated only when a monthly budget applies to that user. This list is not paginated or capped; for large organizations prefer ListEnterpriseUserCreditUsage. |

## Related types

> [accordion] CreditsByType
>
> CreditsByType contains credits consumed for a single usage type.
>
> `gitpod.v1.CreditsByType`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `usageType` | [UsageType](#enum-gitpod-v1-usage-type) | No | |
> | `credits` | number | No | |

> [accordion] CumulativeCreditUsage
>
> CumulativeCreditUsage contains cumulative credit consumption totals.
>
> `gitpod.v1.CumulativeCreditUsage`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `totalCredits` | number | No | Total credits consumed. |
> | `usageByType` | array of [CreditsByType](#type-gitpod-v1-credits-by-type) | No | Credits consumed broken down by usage type. |

> [accordion] EnterpriseAIUsageByModel
>
> `gitpod.v1.EnterpriseAIUsageByModel`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `model` | string | No | |
> | `usage` | EnterpriseAIUsage | No | |
> | `usageByTokenType` | array of EnterpriseAIUsageByTokenType | No | |
> | `unpricedUsage` | EnterpriseAIUsage | No | Usage excluded from spend because no matching BYOK rate was configured. |
> | `unpricedUsageByTokenType` | array of EnterpriseAIUsageByTokenType | No | |

> [accordion] TeamCumulativeCreditUsage
>
> TeamCumulativeCreditUsage contains a team's cumulative credit usage and allocation.
>
> `gitpod.v1.TeamCumulativeCreditUsage`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `teamId` | string | No | |
> | `displayName` | string | No | |
> | `usage` | [CumulativeCreditUsage](#type-gitpod-v1-cumulative-credit-usage) | No | Cumulative credit usage for this team. |
> | `creditBudget` | 64-bit integer string | No | The team's credit allocation (budget) in whole credits, if set. Not set means no allocation has been configured for this team. |

> [accordion] UserCreditBudgetUsage
>
> `gitpod.v1.UserCreditBudgetUsage`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `userId` | string | No | |
> | `displayName` | string | No | |
> | `monthToDateUsage` | [CumulativeCreditUsage](#type-gitpod-v1-cumulative-credit-usage) | No | |
> | `creditBudget` | 64-bit integer string | No | |
> | `budgetSource` | [EnterpriseAIUserBudgetPolicySource](#enum-gitpod-v1-enterprise-ai-user-budget-policy-source) | No | Constraints: `enum.defined_only=true`. |
> | `noCap` | boolean | No | |
> | `utilizationPercent` | number | No | |
> | `overBudget` | boolean | No | |
> | `isServiceAccount` | boolean | No | True when user\_id refers to a service account rather than a human user. The dashboard uses this to mark non-human accounts in admin tables. |
> | `usageByModel` | array of [EnterpriseAIUsageByModel](#type-gitpod-v1-enterprise-ai-usage-by-model) | No | Month-to-date intelligence usage broken down by model. |

> [accordion] EnterpriseAIUserBudgetPolicySource
>
> | Value | Number | Description |
> | - | -: | - |
> | `ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_UNSPECIFIED` | 0 | |
> | `ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_NONE` | 1 | |
> | `ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_ORGANIZATION` | 2 | |
> | `ENTERPRISE_AI_USER_BUDGET_POLICY_SOURCE_USER` | 3 | |

> [accordion] UsageType
>
> UsageType identifies the category of usage.
>
> | Value | Number | Description |
> | - | -: | - |
> | `USAGE_TYPE_UNSPECIFIED` | 0 | |
> | `USAGE_TYPE_ENVIRONMENT` | 1 | |
> | `USAGE_TYPE_AGENTIC` | 2 | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.