> ## 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.

# 更新一个预算的名称、限额或父预算

> 重命名预算、设置或清除其自身的限额，或将其移至另一个预算下。

授权规则与内部预算 API 相同：修改限额需要对该预算的父预算拥有 budget.configure 权限（根级预算使用通配符权限）；重命名需要对父预算拥有 budget.configure 和 budget.share 权限；移动则需要对原父预算和新父预算都拥有这两项权限。
限额规定了月度计费周期内计入该预算及其所有后代预算的用量上限；与组织关联的预算，其 cycle_acu_limit 也会回写为该组织的 ACU 限额。

有关字段详情和示例，请参阅[预算](https://docs.devin.ai/zh/admin/billing/budgets.md#update-a-budget)。

## 权限

需要使用在企业级别具有 `ManageAcuLimits` 权限的[服务用户](https://docs.devin.ai/zh/api-reference/v3/service-users/members-service-users.md)或[个人访问令牌](https://docs.devin.ai/zh/api-reference/personal-access-tokens.md)，或者拥有该预算的[委派访问权限](https://docs.devin.ai/zh/admin/billing/budgets.md#who-can-manage-a-budget)。


## OpenAPI

````yaml zh/v3-openapi.yaml PATCH /v3/enterprise/usage-policies/budgets/{budget_id}
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/{budget_id}:
    patch:
      tags:
        - usage-policy-budgets
      summary: 更新一个预算的名称、限额或父预算
      description: >-
        重命名预算、设置或清除其自身的限额，或将其移至另一个预算下。


        授权规则与内部预算 API 相同：修改限额需要对该预算的父预算拥有 budget.configure
        权限（根级预算使用通配符权限）；重命名需要对父预算拥有 budget.configure 和 budget.share
        权限；移动则需要对原父预算和新父预算都拥有这两项权限。

        限额规定了月度计费周期内计入该预算及其所有后代预算的用量上限；与组织关联的预算，其 cycle_acu_limit 也会回写为该组织的 ACU
        限额。
      operationId: >-
        handle_update_usage_policy_budget_v3_enterprise_usage_policies_budgets__budget_id__patch
      parameters:
        - in: path
          name: budget_id
          required: true
          schema:
            title: Budget Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsagePolicyBudgetUpdateRequest'
        required: true
      responses:
        '200':
          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:
    UsagePolicyBudgetUpdateRequest:
      description: |-
        对预算的名称、自身限额或父预算进行部分更新。省略的字段
        保持不变；null 表示清除限额。
      properties:
        cycle_acu_limit:
          anyOf:
            - maximum: 9223372036854776000
              minimum: 0
              type: integer
            - type: 'null'
          description: 预算新的每周期 ACU 限额；null 表示清除限额。
          title: Cycle Acu Limit
        name:
          anyOf:
            - maxLength: 255
              minLength: 1
              pattern: \S
              type: string
            - type: 'null'
          description: 预算的新显示名称。
          title: Name
        parent_budget_id:
          anyOf:
            - type: string
            - type: 'null'
          description: 将预算及其子预算移至此活跃预算下。根级预算无法移动。
          title: Parent Budget Id
        temporary_cycle_acu_limit:
          anyOf:
            - maximum: 9223372036854776000
              minimum: 0
              type: integer
            - type: 'null'
          description: 覆盖 cycle_acu_limit 的限额，有效期至当前月度计费周期结束；null 表示清除该限额。
          title: Temporary Cycle Acu Limit
      title: UsagePolicyBudgetUpdateRequest
      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.