Skip to main content
REST API はバージョン化されました。 詳細については、「API のバージョン管理について」を参照してください。

予算

REST API を使用して予算情報を取得します。

重要

以下の要求本文スキーマに必須フィールドがありません。 budget_scopeuserされている場合は、予算が適用されるuserユーザー名に設定されたGitHubフィールドも含める必要があります。 このフィールドを省略すると、API は HTTP 400: Missing required fields: budget_entity_name返します。 ユーザー スコープの予算の場合、 budget_entity_name は空の文字列にすることができます。

次の例では、1 人のユーザーの毎月の CopilotAI credits を $30 USD に制限するユーザー スコープの予算を作成します。

{
  "budget_amount": 30,
  "prevent_further_usage": true,
  "budget_scope": "user",
  "budget_entity_name": "",
  "budget_type": "BundlePricing",
  "budget_product_sku": "ai_credits",
  "budget_alerting": {
    "will_alert": false,
    "alert_recipients": []
  },
  "user": "USERNAME"
}

Get all budgets for an organization

Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. Each page returns up to 100 budgets.

"Get all budgets for an organization" のきめ細かいアクセス トークン

このエンドポイントは、次の粒度の細かいトークンの種類で動作します:

粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:

  • "Administration" organization permissions (read)

"Get all budgets for an organization" のパラメーター

ヘッダー
名前, タイプ, 説明
accept string

Setting to application/vnd.github+json is recommended.

パスパラメーター
名前, タイプ, 説明
org string 必須

The organization name. The name is not case sensitive.

クエリ パラメーター
名前, タイプ, 説明
page integer

The page number of the results to fetch.

デフォルト: 1

per_page integer

The number of results per page (max 100).

デフォルト: 10

scope string

Filter budgets by scope type.

  • organization: Budgets scoped to the organization.
  • repository: Budgets scoped to a repository.
  • multi_user_customer: Universal budgets that apply to all users in the organization.
  • user: Budgets scoped to an individual user.

次のいずれかにできます: enterprise, organization, repository, cost_center, multi_user_customer, user

user string

Filter consumed amount details for budgets by the specified user login.

"Get all budgets for an organization" の HTTP 応答状態コード

状態コード説明
200

Response when getting all budgets

403

Forbidden

404