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

# Update Devin Review triggers

> Create, replace, and delete Devin Review auto-review rules and exclusions for an organization in one atomic API call.

Creates, replaces, and deletes [Devin Review auto-review](https://docs.devin.ai/work-with-devin/devin-review.md#auto-review) rules and exclusions in one atomic batch. To see existing triggers, use [List Review triggers](https://docs.devin.ai/api-reference/v3/review-triggers/list-review-triggers.md); to find the repositories you can target, use [List Review trigger scopes](https://docs.devin.ai/api-reference/v3/review-triggers/list-review-trigger-scopes.md).

## Permissions

Requires a [service user](https://docs.devin.ai/api-reference/v3/service-users/members-service-users.md) or [personal access token](https://docs.devin.ai/api-reference/personal-access-tokens.md) with the `ManageReview` permission in the organization. A personal access token acts as its user. Account-wide `ManageReview` lets the caller manage every scope; organization-level `ManageReview` covers only the repositories that organization can access.

## Behavior

* An entry in `upserts` without `entity_id` creates a trigger. With `entity_id` it replaces that trigger and must include `expected_version_id`, the `version_id` last read. Fields you omit keep their stored values.
* `kind` is `rule` (run Review automatically) or `exclusion` (skip matching pull requests).
* `scope` is `account` (every repository Review can see), `repository` (with `repository` as `owner/repo` on github.com or `host/path` elsewhere), or `user` (with `user_id`, for that member's own pull requests).
* For rules, `start` is `pr_open` or `pr_ready` (default), `cadence` is `once` or `every_push` (default), and `effort` is `default`, `normal`, or `ultra`.
* `conditions` narrows a trigger to matching pull requests; on create, leave it out to match every pull request in the scope. On replace, leaving it out keeps the stored conditions; send `null` to clear them.
* Entries in `deletes` name a trigger by `entity_id` and `expected_version_id`.
* The batch is all or nothing. It returns `400` when empty, `403` when any entry targets a scope the caller can't manage, and `409` when an `expected_version_id` is stale. Read the triggers again and retry in the last case.
* Returns `404` when Review triggers are not enabled for the organization.

## Example

```bash theme={null}
curl -X PATCH "https://api.devin.ai/v3beta1/organizations/$ORG_ID/review-settings/default-reviewer/triggers" \
  -H "Authorization: Bearer $DEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "upserts": [
      {
        "kind": "rule",
        "scope": "repository",
        "repository": "acme/web",
        "start": "pr_ready",
        "cadence": "every_push"
      }
    ]
  }'
```


## OpenAPI

````yaml v3-openapi.yaml PATCH /v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers
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/organizations/{org_id}/review-settings/default-reviewer/triggers:
    patch:
      tags:
        - review-settings
      summary: Create, replace or delete default reviewer triggers
      description: Apply a batch of default reviewer trigger changes atomically.
      operationId: >-
        handle_update_review_triggers_v3beta1_organizations__org_id__review_settings_default_reviewer_triggers_patch
      parameters:
        - description: 'Organization ID (prefix: 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/ReviewTriggersUpdateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReviewTriggersUpdateResponse'
          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:
    ReviewTriggersUpdateRequest:
      properties:
        deletes:
          items:
            $ref: '#/components/schemas/ReviewTriggerDeleteRequest'
          maxItems: 100
          title: Deletes
          type: array
        upserts:
          items:
            $ref: '#/components/schemas/ReviewTriggerUpsertRequest'
          maxItems: 100
          title: Upserts
          type: array
      title: ReviewTriggersUpdateRequest
      type: object
    ReviewTriggersUpdateResponse:
      properties:
        deleted_entity_ids:
          items:
            type: string
          title: Deleted Entity Ids
          type: array
        upserted:
          items:
            $ref: '#/components/schemas/ReviewTriggerResponse'
          title: Upserted
          type: array
      required:
        - upserted
        - deleted_entity_ids
      title: ReviewTriggersUpdateResponse
      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
    ReviewTriggerDeleteRequest:
      properties:
        entity_id:
          title: Entity Id
          type: string
        expected_version_id:
          title: Expected Version Id
          type: string
      required:
        - entity_id
        - expected_version_id
      title: ReviewTriggerDeleteRequest
      type: object
    ReviewTriggerUpsertRequest:
      properties:
        cadence:
          anyOf:
            - enum:
                - once
                - every_push
              type: string
            - type: 'null'
          description: Rules only. Defaults to the stored value, else 'every_push'.
          title: Cadence
        conditions:
          anyOf:
            - $ref: '#/components/schemas/ReviewTriggerConditions-Input'
            - type: 'null'
          description: >-
            Clauses joined by AND ('all') or OR ('any'), as the Review settings
            editor saves them; null matches every pull request. Defaults to the
            stored conditions when updating.
        effort:
          anyOf:
            - enum:
                - default
                - normal
                - ultra
              type: string
            - type: 'null'
          description: Rules only. Defaults to the stored value, else 'default'.
          title: Effort
        entity_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Omit to create a trigger; pass an existing id to replace it.
          title: Entity Id
        expected_version_id:
          anyOf:
            - type: string
            - type: 'null'
          description: 'Required with entity_id: the version_id last read. 409 when stale.'
          title: Expected Version Id
        kind:
          anyOf:
            - enum:
                - rule
                - exclusion
              type: string
            - type: 'null'
          description: >-
            'rule' runs Review automatically, 'exclusion' stops matching pull
            requests from being reviewed. Defaults to 'rule' on create and to
            the stored kind when updating.
          title: Kind
        repository:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          description: >-
            Repository name in the form scope targets use: 'owner/repo' on
            github.com, 'host/path' elsewhere. A URL or a 'github.com/' prefix
            is also accepted. Case-insensitive except on Gerrit. Must be a
            repository the caller can attach triggers to (see trigger-scopes).
          title: Repository
        scope:
          anyOf:
            - enum:
                - account
                - repository
                - user
              type: string
            - type: 'null'
          description: >-
            'account' covers every repository Review can see; 'repository' needs
            `repository`; 'user' needs `user_id` and reviews that member's own
            pull requests. Defaults to the stored scope when updating.
          title: Scope
        start:
          anyOf:
            - enum:
                - pr_open
                - pr_ready
              type: string
            - type: 'null'
          description: Rules only. Defaults to the stored value, else 'pr_ready'.
          title: Start
        user_id:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: >-
            With scope 'user': an account member (see members). Setting another
            person's trigger needs account-wide Manage Review.
          title: User Id
      title: ReviewTriggerUpsertRequest
      type: object
    ReviewTriggerResponse:
      properties:
        cadence:
          anyOf:
            - enum:
                - once
                - every_push
              type: string
            - type: 'null'
          description: 'Rules: review once, or again on every push. Null for exclusions.'
          title: Cadence
        conditions:
          anyOf:
            - $ref: '#/components/schemas/ReviewTriggerConditions-Output'
            - type: 'null'
          description: >-
            Clauses joined by AND ('all') or OR ('any'), as the Review settings
            editor saves them; null matches every pull request.
        created_at:
          title: Created At
          type: integer
        effort:
          anyOf:
            - enum:
                - default
                - normal
                - ultra
              type: string
            - type: 'null'
          description: Rules only.
          title: Effort
        entity_id:
          title: Entity Id
          type: string
        kind:
          enum:
            - rule
            - exclusion
          title: Kind
          type: string
        modified_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Modified By User Id
        readonly:
          title: Readonly
          type: boolean
        removable:
          title: Removable
          type: boolean
        scope:
          $ref: '#/components/schemas/ReviewScopeResponse'
        start:
          anyOf:
            - enum:
                - pr_open
                - pr_ready
                - check_passed
                - pre_pr
                - with_review
              type: string
            - type: 'null'
          description: >-
            Rules: when the first review runs, on PR creation or when the PR is
            ready for review. Rules saved in Review settings can also start when
            a check passes ('check_passed'), before the PR opens ('pre_pr') or
            only alongside another review ('with_review'). Null for exclusions.
          title: Start
        version_id:
          description: Changes on every save; pass it back as expected_version_id.
          title: Version Id
          type: string
      required:
        - entity_id
        - version_id
        - kind
        - scope
        - conditions
        - start
        - cadence
        - effort
        - readonly
        - removable
        - modified_by_user_id
        - created_at
      title: ReviewTriggerResponse
      type: object
    ReviewTriggerConditions-Input:
      additionalProperties: false
      properties:
        clauses:
          items:
            discriminator:
              mapping:
                author: '#/components/schemas/ReviewTriggerUserClause'
                author_type: '#/components/schemas/ReviewTriggerAuthorTypeClause'
                changed_file: '#/components/schemas/ReviewTriggerPatternClause'
                label: '#/components/schemas/ReviewTriggerLabelClause'
                line_diff: '#/components/schemas/ReviewTriggerLineDiffClause'
                originated_by: '#/components/schemas/ReviewTriggerOriginatedByClause'
                repository: '#/components/schemas/ReviewTriggerRepositoryClause'
                reviewer: '#/components/schemas/ReviewTriggerUserClause'
                source_branch: '#/components/schemas/ReviewTriggerPatternClause'
                target_branch: '#/components/schemas/ReviewTriggerPatternClause'
                title: '#/components/schemas/ReviewTriggerPatternClause'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/ReviewTriggerUserClause'
              - $ref: '#/components/schemas/ReviewTriggerLabelClause'
              - $ref: '#/components/schemas/ReviewTriggerPatternClause'
              - $ref: '#/components/schemas/ReviewTriggerRepositoryClause'
              - $ref: '#/components/schemas/ReviewTriggerAuthorTypeClause'
              - $ref: '#/components/schemas/ReviewTriggerOriginatedByClause'
              - $ref: '#/components/schemas/ReviewTriggerLineDiffClause'
          maxItems: 50
          minItems: 1
          title: Clauses
          type: array
        match:
          description: '`all`: every clause must match; `any`: at least one must.'
          enum:
            - all
            - any
          title: Match
          type: string
      required:
        - match
        - clauses
      title: ReviewTriggerConditions
      type: object
    ReviewTriggerConditions-Output:
      additionalProperties: false
      properties:
        clauses:
          items:
            discriminator:
              mapping:
                author: '#/components/schemas/ReviewTriggerUserClause'
                author_type: '#/components/schemas/ReviewTriggerAuthorTypeClause'
                changed_file: '#/components/schemas/ReviewTriggerPatternClause'
                label: '#/components/schemas/ReviewTriggerLabelClause'
                line_diff: '#/components/schemas/ReviewTriggerLineDiffClause'
                originated_by: '#/components/schemas/ReviewTriggerOriginatedByClause'
                repository: '#/components/schemas/ReviewTriggerRepositoryClause'
                reviewer: '#/components/schemas/ReviewTriggerUserClause'
                source_branch: '#/components/schemas/ReviewTriggerPatternClause'
                target_branch: '#/components/schemas/ReviewTriggerPatternClause'
                title: '#/components/schemas/ReviewTriggerPatternClause'
              propertyName: kind
            oneOf:
              - $ref: '#/components/schemas/ReviewTriggerUserClause'
              - $ref: '#/components/schemas/ReviewTriggerLabelClause'
              - $ref: '#/components/schemas/ReviewTriggerPatternClause'
              - $ref: '#/components/schemas/ReviewTriggerRepositoryClause'
              - $ref: '#/components/schemas/ReviewTriggerAuthorTypeClause'
              - $ref: '#/components/schemas/ReviewTriggerOriginatedByClause'
              - $ref: '#/components/schemas/ReviewTriggerLineDiffClause'
          maxItems: 50
          minItems: 1
          title: Clauses
          type: array
        match:
          description: '`all`: every clause must match; `any`: at least one must.'
          enum:
            - all
            - any
          title: Match
          type: string
      required:
        - match
        - clauses
      title: ReviewTriggerConditions
      type: object
    ReviewScopeResponse:
      properties:
        kind:
          enum:
            - account
            - user
            - git_organization
            - git_repository
          title: Kind
          type: string
        target:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            git_repository: the repository name, 'owner/repo' on github.com and
            'host/path' on every other host
            ('gitlab.example.com/group/sub/repo'), percent-encoded per segment.
            git_organization: the namespace in the same form, ending in '/'.
            Null for account and user scopes.
          title: Target
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
      required:
        - kind
        - target
      title: ReviewScopeResponse
      type: object
    ReviewTriggerUserClause:
      additionalProperties: false
      properties:
        kind:
          description: The pull request's author, or a requested reviewer.
          enum:
            - author
            - reviewer
          title: Kind
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        users:
          description: Matches when any of these users is the one.
          items:
            $ref: '#/components/schemas/ReviewTriggerUser'
          minItems: 1
          title: Users
          type: array
      required:
        - kind
        - users
      title: ReviewTriggerUserClause
      type: object
    ReviewTriggerAuthorTypeClause:
      additionalProperties: false
      properties:
        kind:
          const: author_type
          title: Kind
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        value:
          items:
            enum:
              - user
              - bot
              - devin
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerAuthorTypeClause
      type: object
    ReviewTriggerPatternClause:
      additionalProperties: false
      properties:
        kind:
          enum:
            - title
            - source_branch
            - target_branch
            - changed_file
          title: Kind
          type: string
        match:
          default: glob
          enum:
            - glob
            - exact
          title: Match
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        value:
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerPatternClause
      type: object
    ReviewTriggerLabelClause:
      additionalProperties: false
      properties:
        kind:
          const: label
          title: Kind
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        value:
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerLabelClause
      type: object
    ReviewTriggerLineDiffClause:
      additionalProperties: false
      properties:
        kind:
          const: line_diff
          description: Lines added plus lines removed.
          title: Kind
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        operator:
          enum:
            - lt
            - lte
            - gt
            - gte
          title: Operator
          type: string
        value:
          minimum: 0
          title: Value
          type: integer
      required:
        - kind
        - operator
        - value
      title: ReviewTriggerLineDiffClause
      type: object
    ReviewTriggerOriginatedByClause:
      additionalProperties: false
      properties:
        kind:
          const: originated_by
          description: A Devin session created or took over the pull request.
          title: Kind
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        value:
          items:
            const: devin
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerOriginatedByClause
      type: object
    ReviewTriggerRepositoryClause:
      additionalProperties: false
      properties:
        kind:
          const: repository
          title: Kind
          type: string
        match:
          default: glob
          enum:
            - glob
            - exact
          title: Match
          type: string
        negate:
          default: false
          description: Match pull requests the clause does not match.
          title: Negate
          type: boolean
        value:
          description: '''owner/repo'' names or globs.'
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerRepositoryClause
      type: object
    ReviewTriggerUser:
      additionalProperties: false
      properties:
        kind:
          description: >-
            `devin`: an account member by user ID, matched through their linked
            git logins; `scm`: a git login.
          enum:
            - devin
            - scm
          title: Kind
          type: string
        value:
          minLength: 1
          title: Value
          type: string
      required:
        - kind
        - value
      title: ReviewTriggerUser
      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.