> ## 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 Enterprise AI User Budget Policy

> Gets the configured and effective monthly budget policy for a user or org.

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

Gets the configured and effective monthly budget policy for a user or org.

When user\_id is provided, the response includes any direct user override
and the effective policy after applying the organization default. When
user\_id is omitted, both fields describe the organization default.

### Authorization

Requires `billing:read_usage` permission on the organization.

## Endpoint

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

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/GetEnterpriseAIUserBudgetPolicy" \
  --header "Authorization: Bearer $ONA_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "mode": "ENTERPRISE_AI_USER_BUDGET_MODE_CREDITS",
  "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.GetEnterpriseAIUserBudgetPolicyRequest(
    organization_id="<organization-id>",
    mode=billing_pb2.ENTERPRISE_AI_USER_BUDGET_MODE_CREDITS,
)
response = ona.services.billing.get_enterprise_ai_user_budget_policy(request)
print(response)
```

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

async function main() {
  const ona = createClientFromEnv();
  const request = create(GetEnterpriseAIUserBudgetPolicyRequestSchema, {
    organizationId: "<organization-id>",
    mode: EnterpriseAIUserBudgetMode.CREDITS,
  });
  const response = await ona.services.billing.getEnterpriseAIUserBudgetPolicy(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.GetEnterpriseAIUserBudgetPolicyRequest{
		OrganizationId: "<organization-id>",
		Mode: gitpodpb.EnterpriseAIUserBudgetMode_ENTERPRISE_AI_USER_BUDGET_MODE_CREDITS,
	})
	response, err := ona.Services.Billing.GetEnterpriseAIUserBudgetPolicy(context.Background(), request)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(response.Msg)
}
```

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

## Request

`gitpod.v1.GetEnterpriseAIUserBudgetPolicyRequest`

| Field | Type | Required | Description |
| - | - | - | - |
| `organizationId` | string | Yes | Constraints: `required=true, string.uuid=true`. |
| `mode` | [EnterpriseAIUserBudgetMode](#enum-gitpod-v1-enterprise-ai-user-budget-mode) | Yes | Constraints: `enum.defined_only=true, enum.not_in=0, required=true`. |
| `userId` | string | No | Constraints: `string.uuid=true`. |

## Response

`gitpod.v1.GetEnterpriseAIUserBudgetPolicyResponse`

| Field | Type | Required | Description |
| - | - | - | - |
| `policy` | [EnterpriseAIUserBudgetPolicy](#type-gitpod-v1-enterprise-ai-user-budget-policy) | No | |
| `effectivePolicy` | [EffectiveEnterpriseAIUserBudgetPolicy](#type-gitpod-v1-effective-enterprise-ai-user-budget-policy) | No | |

## Related types

> [accordion] EffectiveEnterpriseAIUserBudgetPolicy
>
> `gitpod.v1.EffectiveEnterpriseAIUserBudgetPolicy`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `source` | [EnterpriseAIUserBudgetPolicySource](#enum-gitpod-v1-enterprise-ai-user-budget-policy-source) | No | Constraints: `enum.defined_only=true`. |
> | `policy` | [EnterpriseAIUserBudgetPolicy](#type-gitpod-v1-enterprise-ai-user-budget-policy) | No | |

> [accordion] EnterpriseAIUserBudgetPolicy
>
> `gitpod.v1.EnterpriseAIUserBudgetPolicy`
>
> | Field | Type | Required | Description |
> | - | - | - | - |
> | `id` | string | No | Constraints: `string.uuid=true`. |
> | `organizationId` | string | No | Constraints: `string.uuid=true`. |
> | `mode` | [EnterpriseAIUserBudgetMode](#enum-gitpod-v1-enterprise-ai-user-budget-mode) | No | Constraints: `enum.defined_only=true`. |
> | `userId` | string | No | Constraints: `string.uuid=true`. |
> | `monthlyCreditLimit` | 64-bit integer string | No | monthly\_credit\_limit is the credit/Ona Intelligence monthly budget in whole credits. Constraints: `int64.gte=0`. |
> | `monthlyCostLimitMicrounits` | 64-bit integer string | No | monthly\_cost\_limit\_microunits is the BYOK monthly budget in micro-units of currency. Constraints: `int64.gte=0`. |
> | `currency` | [BillingCurrency](#enum-gitpod-v1-billing-currency) | No | Constraints: `enum.defined_only=true`. |
> | `noCap` | boolean | No | |
> | `createdAt` | RFC 3339 timestamp | No | |
> | `updatedAt` | RFC 3339 timestamp | No | |

> [accordion] BillingCurrency
>
> | Value | Number | Description |
> | - | -: | - |
> | `BILLING_CURRENCY_UNSPECIFIED` | 0 | |
> | `BILLING_CURRENCY_USD` | 1 | |
> | `BILLING_CURRENCY_EUR` | 2 | |
> | `BILLING_CURRENCY_GBP` | 3 | |

> [accordion] EnterpriseAIUserBudgetMode
>
> | Value | Number | Description |
> | - | -: | - |
> | `ENTERPRISE_AI_USER_BUDGET_MODE_UNSPECIFIED` | 0 | |
> | `ENTERPRISE_AI_USER_BUDGET_MODE_CREDITS` | 1 | |
> | `ENTERPRISE_AI_USER_BUDGET_MODE_BYOK` | 2 | |

> [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 | |


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