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

# リポジトリのレビュー請求ルールを設定

> 単一のリポジトリで今後発生するレビュー使用量の請求先を、組織または予算に設定します。

特定のリポジトリ1件に対する請求ルールを作成または置き換えます。これにより、そのリポジトリでの今後の [Devin Review](https://docs.devin.ai/ja/work-with-devin/devin-review.md#review-effort-and-billing-organization) の使用量が、組織または[予算](https://docs.devin.ai/ja/admin/billing/budgets.md)に請求されるようになります。既存のルールを確認するには、[リポジトリの請求ルール一覧](https://docs.devin.ai/ja/api-reference/v3/review-billing-rules/list-enterprise-organization-review-billing-rules.md)を利用してください。

## 権限

組織内で `ManageReview` 権限を持つ[サービスユーザー](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)のみです。

## 動作

* `repository` には、github.com の場合は `owner/repo`、その他のプロバイダーの場合は `host/path`、またはリポジトリの完全な URL を指定できます。指定するリポジトリは 1 つに特定できる必要があります。ワイルドカードを指定すると `422` で拒否されます。
* 1 つのリポジトリに設定できるルールは最大 1 つです。すでにルールが設定されているリポジトリを送信すると、支払い元が置き換えられ、ルールの `id` はそのまま維持されます。
* `bill_to.type` は `organization` または `budget` で、`bill_to.id` にはそれに対応する組織IDまたは予算 ID を指定します。呼び出し元が利用できない対象を指定すると、`400` または `403` が返されます。
* ルールは今後のレビューにのみ適用されます。すでに課金された使用量は移動されません。
* 同じホスト上の別の Git接続を通じてリポジトリがすでに関連付け済みの場合、またはリクエスト処理中にルールが変更された場合は、`409` が返されます。後者の場合は、リクエストを再試行してください。


## OpenAPI

````yaml ja/v3-openapi.yaml PUT /v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules
openapi: 3.1.0
info:
  description: Service User 認証および RBAC に対応した Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules:
    put:
      tags:
        - review-billing
      summary: リポジトリのレビュー請求ルールを設定
      description: 単一のリポジトリで今後発生するレビュー使用量の請求先を、組織または予算に設定します。
      operationId: >-
        handle_set_review_repo_billing_rule_v3beta1_enterprise_organizations__org_id__review_settings_repo_billing_rules_put
      parameters:
        - description: 組織ID（プレフィックス：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReviewRepoBillingRuleUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReviewRepoBillingRuleResponse'
          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:
    ReviewRepoBillingRuleUpdateRequest:
      properties:
        bill_to:
          $ref: '#/components/schemas/ReviewRepoBillingRuleBillTo'
        repository:
          description: github.com では 'owner/repo'、その他のプロバイダーでは 'host/path'。完全な URL も指定可能
          maxLength: 1024
          minLength: 1
          title: Repository
          type: string
      required:
        - repository
        - bill_to
      title: ReviewRepoBillingRuleUpdateRequest
      type: object
    ReviewRepoBillingRuleResponse:
      properties:
        bill_to:
          $ref: '#/components/schemas/ReviewRepoBillingRuleBillTo'
          description: リポジトリで今後発生する Devin Review の使用量に応じた料金の支払元
        created_at:
          title: Created At
          type: integer
        id:
          description: ルールの削除に使用する請求ルール ID
          title: Id
          type: string
        repository:
          description: github.com では 'owner/repo'、その他のプロバイダーでは 'host/path'
          title: Repository
          type: string
        updated_at:
          title: Updated At
          type: integer
      required:
        - id
        - repository
        - bill_to
        - created_at
        - updated_at
      title: ReviewRepoBillingRuleResponse
      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
    ReviewRepoBillingRuleBillTo:
      properties:
        id:
          description: 組織 ID または予算 ID
          maxLength: 256
          minLength: 1
          title: Id
          type: string
        type:
          description: 支払元が組織か予算か
          enum:
            - organization
            - budget
          title: Type
          type: string
      required:
        - type
        - id
      title: ReviewRepoBillingRuleBillTo
      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.