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

# 予算を作成

> parent_budget_id で指定した親予算の下に予算を作成します。

認可要件は内部の予算APIと同じで、親予算に対する budget.configure と budget.share 権限が必要です。parent_budget_id を省略するとルート予算を作成しますが、アカウントにすでにルート予算がある場合は409を返します。

各フィールドの詳細と使用例については、[予算](https://docs.devin.ai/ja/admin/billing/budgets.md)を参照してください。

## 権限

エンタープライズレベルで `ManageAcuLimits` 権限を持つ[サービスユーザー](https://docs.devin.ai/ja/api-reference/v3/service-users/members-service-users.md)または[個人用アクセストークン](https://docs.devin.ai/ja/api-reference/personal-access-tokens.md)、もしくは対象の予算に対する[委任アクセス](https://docs.devin.ai/ja/admin/billing/budgets.md#who-can-manage-a-budget)が必要です。


## OpenAPI

````yaml ja/v3-openapi.yaml POST /v3/enterprise/usage-policies/budgets
openapi: 3.1.0
info:
  description: Service User 認証および RBAC に対応した Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/usage-policies/budgets:
    post:
      tags:
        - usage-policy-budgets
      summary: 予算を作成
      description: >-
        parent_budget_id で指定した親予算の下に予算を作成します。


        認可要件は内部の予算APIと同じで、親予算に対する budget.configure と budget.share
        権限が必要です。parent_budget_id
        を省略するとルート予算を作成しますが、アカウントにすでにルート予算がある場合は409を返します。
      operationId: >-
        handle_create_usage_policy_budget_v3_enterprise_usage_policies_budgets_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsagePolicyBudgetCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsagePolicyBudgetResponse'
          description: 成功レスポンス
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 認証されていません
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: アクセスが禁止されています
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 見つかりません
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 競合
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 削除済み
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 処理できないコンテンツ
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: リクエスト過多
components:
  schemas:
    UsagePolicyBudgetCreateRequest:
      additionalProperties: false
      description: |-
        新しい予算。API 側で独自に定義した、内部の ``BudgetCreateRequest`` のコピーです。
        内部モデルの変更が公開 API の仕様に影響しないようにしています。
      properties:
        copy_parent_grants:
          default: false
          description: 親予算のアクセス権限付与を新しい予算にコピーします。
          title: Copy Parent Grants
          type: boolean
        cycle_acu_limit:
          anyOf:
            - maximum: 9223372036854776000
              minimum: 0
              type: integer
            - type: 'null'
          description: 予算自体のサイクルごとのACU上限。null を指定すると上限を設定しません。
          title: Cycle Acu Limit
        name:
          description: 予算の表示名。
          maxLength: 255
          minLength: 1
          pattern: \S
          title: Name
          type: string
        parent_budget_id:
          anyOf:
            - type: string
            - type: 'null'
          description: この予算の作成先となるアクティブな親予算。省略すると、アカウントのルート予算を作成します。
          title: Parent Budget Id
      required:
        - name
      title: UsagePolicyBudgetCreateRequest
      type: object
    UsagePolicyBudgetResponse:
      description: |-
        使用量ポリシーが次のパスで管理される予算：
        /usage-policies/budgets/{budget_id}/...
      properties:
        budget_id:
          description: 予算の固定の外部識別子。
          title: Budget Id
          type: string
        cycle_acu_limit:
          anyOf:
            - type: integer
            - type: 'null'
          description: この予算とその配下の予算に計上される消費量に対する、サイクルごとのACU上限。null は無制限を意味します。
          title: Cycle Acu Limit
        name:
          description: 予算の表示名。
          title: Name
          type: string
        org_ids:
          description: この予算にリンクされた組織。これらの組織の使用量がこの予算に計上されます。リンクされた組織がない場合は空です。
          items:
            type: string
          title: Org Ids
          type: array
        parent_budget_id:
          anyOf:
            - type: string
            - type: 'null'
          description: 親予算。アカウントのルート予算の場合は null。
          title: Parent Budget Id
        status:
          description: 予算のライフサイクルステータス。
          enum:
            - active
            - archived
          title: Status
          type: string
        temporary_cycle_acu_limit:
          anyOf:
            - type: integer
            - type: 'null'
          description: 現在の月次請求期間の終了まで cycle_acu_limit に優先して適用される上限。有効な間のみ存在します。
          title: Temporary Cycle Acu Limit
      required:
        - budget_id
        - name
        - parent_budget_id
        - org_ids
        - status
        - cycle_acu_limit
        - temporary_cycle_acu_limit
      title: UsagePolicyBudgetResponse
      type: object
    ProblemDetail:
      description: >-
        v3 API 用の RFC 9457 application/problem+json エラーボディ。


        detail は後方互換性のため、レガシーな {"detail": ...}
        ボディから引き継がれます。その他のメンバーは追加式です。errors にはフィールドレベルのバリデーションエラーが含まれます（422
        の場合のみ）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: この事象に固有の、人が読める説明。
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: ブロックされた操作の拒否理由を示す機械可読コード（例："user_frozen"、"migrated_session"）。
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: フィールド単位のバリデーションエラー（422 レスポンスのみ）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: この発生箇所の URI 参照（リクエストパス）。
          title: Instance
        status:
          description: HTTP ステータスコード。
          title: Status
          type: integer
        title:
          description: 問題タイプを人が読める短い要約。
          title: Title
          type: string
        type:
          default: about:blank
          description: 問題タイプを識別する URI 参照。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
  securitySchemes:
    bearerAuth:
      description: 'サービスユーザーの認証情報（接頭辞: cog_）'
      scheme: bearer
      type: http

````

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