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

# Set a repository's Review billing rule

> Assign future Review usage on one repository to an organization or budget.

Creates or replaces the billing rule for one exact repository, so that future [Devin Review](https://docs.devinenterprise.com/work-with-devin/devin-review.md#review-effort-and-billing-organization) usage on it is charged to an organization or a [budget](https://docs.devinenterprise.com/admin/billing/budgets.md). To see existing rules, use [List repository billing rules](https://docs.devinenterprise.com/api-reference/v3/review-billing-rules/list-enterprise-review-billing-rules.md).

## Permissions

Requires a [service user](https://docs.devinenterprise.com/api-reference/v3/service-users/members-service-users.md) or [personal access token](https://docs.devinenterprise.com/api-reference/personal-access-tokens.md) with the `ManageReview` permission at the enterprise level.

## Behavior

* `repository` accepts `owner/repo` for github.com, `host/path` for other providers, or a full repository URL. It must name one exact repository. Wildcards are rejected with `422`.
* A repository has at most one rule. Sending a repository that already has a rule replaces who pays and keeps the same rule `id`.
* `bill_to.type` is `organization` or `budget`, and `bill_to.id` is the matching organization ID or budget ID. A target the caller can't use returns `400` or `403`.
* The rule applies to future reviews only. Usage already charged is not moved.
* Returns `409` when the repository is already mapped through another git connection on the same host, or when the rule changed during the request. Retry the request in the second case.


## OpenAPI

````yaml v3-openapi.yaml PUT /v3beta1/enterprise/review-settings/repo-billing-rules
openapi: 3.1.0
info:
  description: Devin v3 API with Service User authentication and RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3beta1/enterprise/review-settings/repo-billing-rules:
    put:
      tags:
        - review-billing
      summary: Set a repository's Review billing rule
      description: >-
        Assign future Review usage on one repository to an organization or
        budget.
      operationId: >-
        handle_set_review_repo_billing_rule_v3beta1_enterprise_review_settings_repo_billing_rules_put
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReviewRepoBillingRuleUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReviewRepoBillingRuleResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Conflict
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Gone
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unprocessable Content
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Too Many Requests
components:
  schemas:
    ReviewRepoBillingRuleUpdateRequest:
      properties:
        bill_to:
          $ref: '#/components/schemas/ReviewRepoBillingRuleBillTo'
        repository:
          description: >-
            'owner/repo' on github.com, 'host/path' on other providers; a full
            URL is also accepted
          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: Who pays for future Devin Review usage on the repository
        created_at:
          title: Created At
          type: integer
        id:
          description: The billing rule ID, used to remove the rule
          title: Id
          type: string
        repository:
          description: '''owner/repo'' on github.com, ''host/path'' on other providers'
          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: >-
        RFC 9457 application/problem+json error body for the v3 API.


        detail is retained from the legacy {"detail": ...} body for back-compat;
        the

        other members are additive. errors carries field-level validation
        failures

        (422 only).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: A human-readable explanation specific to this occurrence.
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Machine-readable code for blocked-action refusals (e.g.
            "user_frozen", "migrated_session").
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Field-level validation errors (422 responses only).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: A URI reference (the request path) for this occurrence.
          title: Instance
        status:
          description: The HTTP status code.
          title: Status
          type: integer
        title:
          description: A short, human-readable summary of the problem type.
          title: Title
          type: string
        type:
          default: about:blank
          description: A URI reference identifying the problem type.
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    ReviewRepoBillingRuleBillTo:
      properties:
        id:
          description: The org ID or the budget ID
          maxLength: 256
          minLength: 1
          title: Id
          type: string
        type:
          description: Whether an organization or a budget pays
          enum:
            - organization
            - budget
          title: Type
          type: string
      required:
        - type
        - id
      title: ReviewRepoBillingRuleBillTo
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````

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