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

# Aggiorna i trigger di Devin Review

> Crea, sostituisce ed elimina le regole e le esclusioni di auto-review di Devin Review per un'organizzazione con un'unica chiamata API atomica.

Crea, sostituisce ed elimina le regole e le esclusioni di [auto-review di Devin Review](https://docs.devin.ai/it/work-with-devin/devin-review.md#auto-review) in un unico batch atomico. Per visualizzare i trigger esistenti, usa [Elenca i trigger di Review](https://docs.devin.ai/it/api-reference/v3/review-triggers/list-review-triggers.md); per individuare i repository a cui puoi applicarli, usa [Elenca gli ambiti dei trigger di Review](https://docs.devin.ai/it/api-reference/v3/review-triggers/list-review-trigger-scopes.md).

## Autorizzazioni

Richiede un [utente di servizio](https://docs.devin.ai/it/api-reference/v3/service-users/members-service-users.md) o un [token di accesso personale](https://docs.devin.ai/it/api-reference/personal-access-tokens.md) con l'autorizzazione `ManageReview` nell'organizzazione. Un token di accesso personale agisce per conto del relativo utente. L'autorizzazione `ManageReview` a livello di account consente al chiamante di gestire tutti gli ambiti; l'autorizzazione `ManageReview` organization-level copre solo i repository a cui l'organizzazione ha accesso.

## Comportamento

* Una voce in `upserts` senza `entity_id` crea un trigger. Con `entity_id` sostituisce quel trigger e deve includere `expected_version_id`, ovvero l'ultimo `version_id` letto. I campi omessi mantengono i rispettivi valori memorizzati.
* `kind` è `rule` (esegue Review automaticamente) oppure `exclusion` (salta le pull request corrispondenti).
* `scope` è `account` (tutti i repository visibili a Review), `repository` (con `repository` nel formato `owner/repo` su github.com oppure `host/path` altrove) oppure `user` (con `user_id`, per le pull request di quel membro).
* Per le regole, `start` è `pr_open` oppure `pr_ready` (predefinito), `cadence` è `once` oppure `every_push` (predefinito) ed `effort` è `default`, `normal` oppure `ultra`.
* `conditions` limita un trigger alle pull request corrispondenti; in fase di creazione, omettilo per includere tutte le pull request nell'ambito. In fase di sostituzione, se lo ometti vengono mantenute le condizioni memorizzate; invia `null` per cancellarle.
* Le voci in `deletes` identificano un trigger tramite `entity_id` ed `expected_version_id`.
* Il batch è atomico: viene applicato per intero o per niente. Restituisce `400` se è vuoto, `403` se una qualsiasi voce riguarda un ambito che il chiamante non può gestire e `409` se un `expected_version_id` è obsoleto. In quest'ultimo caso, rileggi i trigger e riprova.
* Restituisce `404` se i trigger di Review non sono abilitati per l'organizzazione.

## Esempio

```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 it/v3-openapi.yaml PATCH /v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers
openapi: 3.1.0
info:
  description: API Devin v3 con autenticazione utente di servizio e 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: Crea, sostituisci o elimina i trigger predefiniti dei revisori
      description: >-
        Applica in modo atomico un insieme di modifiche ai trigger del revisore
        predefinito.
      operationId: >-
        handle_update_review_triggers_v3beta1_organizations__org_id__review_settings_default_reviewer_triggers_patch
      parameters:
        - description: 'ID dell''organizzazione (prefisso: 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: Risposta riuscita
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Non autorizzato
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Vietato
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Non trovato
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Conflitto
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Non più disponibile
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Contenuto non elaborabile
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Troppe Richieste
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: >-
        Corpo dell'errore application/problem+json RFC 9457 per l'API v3.


        detail è mantenuto dal corpo legacy {"detail": ...} per
        retrocompatibilità; gli

        altri membri sono aggiuntivi. errors contiene gli errori di validazione
        a livello di campo

        (solo 422).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Una spiegazione leggibile dall'utente, specifica per questa
            occorrenza.
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Codice elaborabile automaticamente che indica il rifiuto di
            un'azione bloccata (ad es. "user_frozen", "migrated_session").
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Errori di convalida a livello di campo (solo per le risposte 422).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Un riferimento URI (il percorso della richiesta) per questa
            occorrenza.
          title: Instance
        status:
          description: Il codice di stato HTTP.
          title: Status
          type: integer
        title:
          description: Un breve riepilogo del tipo di problema, leggibile dall'utente.
          title: Title
          type: string
        type:
          default: about:blank
          description: Un riferimento URI che identifica il tipo di problema.
          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: >-
            Solo per le regole. Il valore predefinito è quello memorizzato o, in
            sua assenza, 'every_push'.
          title: Cadence
        conditions:
          anyOf:
            - $ref: '#/components/schemas/ReviewTriggerConditions-Input'
            - type: 'null'
          description: >-
            Clausole unite da AND ('all') o OR ('any'), così come salvate
            dall'editor delle impostazioni di revisione; null corrisponde a
            tutte le pull request. In fase di aggiornamento, le condizioni
            predefinite sono quelle memorizzate.
        effort:
          anyOf:
            - enum:
                - default
                - normal
                - ultra
              type: string
            - type: 'null'
          description: >-
            Solo per le regole. Il valore predefinito è quello memorizzato o, in
            sua assenza, 'default'.
          title: Effort
        entity_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Ometti per creare un trigger; passa un id esistente per sostituirlo.
          title: Entity Id
        expected_version_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Obbligatorio con entity_id: l'ultimo version_id letto. Restituisce
            409 se non è più aggiornato.
          title: Expected Version Id
        kind:
          anyOf:
            - enum:
                - rule
                - exclusion
              type: string
            - type: 'null'
          description: >-
            'rule' esegue Review automaticamente; 'exclusion' impedisce la
            revisione delle pull request corrispondenti. Il valore predefinito è
            'rule' alla creazione e il tipo memorizzato in fase di
            aggiornamento.
          title: Kind
        repository:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          description: >-
            Nome del repository nel formato usato per le destinazioni
            dell'ambito: 'owner/repo' su github.com, 'host/path' altrove. Sono
            accettati anche un URL o il prefisso 'github.com/'. Non distingue
            tra maiuscole e minuscole, tranne su Gerrit. Deve essere un
            repository a cui il chiamante può allegare trigger (vedi
            trigger-scopes).
          title: Repository
        scope:
          anyOf:
            - enum:
                - account
                - repository
                - user
              type: string
            - type: 'null'
          description: >-
            'account' comprende tutti i repository visibili a Review;
            'repository' richiede `repository`; 'user' richiede `user_id` e
            sottopone a revisione le pull request di quel membro. In fase di
            aggiornamento, l'ambito predefinito è quello memorizzato.
          title: Scope
        start:
          anyOf:
            - enum:
                - pr_open
                - pr_ready
              type: string
            - type: 'null'
          description: >-
            Solo per le regole. Il valore predefinito è quello memorizzato o, in
            sua assenza, 'pr_ready'.
          title: Start
        user_id:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: >-
            Con ambito 'user': un membro dell'account (vedi members). Per
            impostare il trigger di un'altra persona è necessaria
            l'autorizzazione Manage Review account-wide.
          title: User Id
      title: ReviewTriggerUpsertRequest
      type: object
    ReviewTriggerResponse:
      properties:
        cadence:
          anyOf:
            - enum:
                - once
                - every_push
              type: string
            - type: 'null'
          description: >-
            Regole: eseguire la revisione una sola volta oppure ripeterla a ogni
            push. Null per le esclusioni.
          title: Cadence
        conditions:
          anyOf:
            - $ref: '#/components/schemas/ReviewTriggerConditions-Output'
            - type: 'null'
          description: >-
            Clausole combinate con AND ('all') o OR ('any'), così come vengono
            salvate dall'editor delle impostazioni di revisione; null
            corrisponde a qualsiasi pull request.
        created_at:
          title: Created At
          type: integer
        effort:
          anyOf:
            - enum:
                - default
                - normal
                - ultra
              type: string
            - type: 'null'
          description: Solo regole.
          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: >-
            Regole: quando eseguire la prima revisione, alla creazione della PR
            o quando la PR è pronta per la revisione. Le regole salvate nelle
            impostazioni di revisione possono anche attivarsi al superamento di
            una verifica ('check_passed'), prima dell'apertura della PR
            ('pre_pr') o solo insieme a un'altra revisione ('with_review'). Null
            per le esclusioni.
          title: Start
        version_id:
          description: >-
            Cambia a ogni salvataggio; passalo nuovamente come
            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'
                repo_visibility: '#/components/schemas/ReviewTriggerRepoVisibilityClause'
                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/ReviewTriggerRepoVisibilityClause'
              - $ref: '#/components/schemas/ReviewTriggerLineDiffClause'
          maxItems: 50
          minItems: 1
          title: Clauses
          type: array
        match:
          description: >-
            `all`: tutte le clausole devono essere soddisfatte; `any`: almeno
            una deve esserlo.
          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'
                repo_visibility: '#/components/schemas/ReviewTriggerRepoVisibilityClause'
                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/ReviewTriggerRepoVisibilityClause'
              - $ref: '#/components/schemas/ReviewTriggerLineDiffClause'
          maxItems: 50
          minItems: 1
          title: Clauses
          type: array
        match:
          description: >-
            `all`: tutte le clausole devono essere soddisfatte; `any`: almeno
            una deve esserlo.
          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: il nome del repository, 'owner/repo' su github.com e
            'host/path' su qualsiasi altro host
            ('gitlab.example.com/group/sub/repo'), con codifica percentuale per
            ciascun segmento. git_organization: il namespace nello stesso
            formato, con '/' finale. Null per gli ambiti account e utente.
          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: >-
            L'autore della pull request o un revisore a cui è stata richiesta
            una revisione.
          enum:
            - author
            - reviewer
          title: Kind
          type: string
        negate:
          default: false
          description: Seleziona le pull request che non corrispondono alla clausola.
          title: Negate
          type: boolean
        users:
          description: >-
            La corrispondenza si verifica se l'utente in questione è uno di
            quelli indicati.
          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: Seleziona le pull request che non soddisfano la clausola.
          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: Seleziona le pull request che non soddisfano la clausola.
          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: Seleziona le pull request che non soddisfano la clausola.
          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: Somma delle righe aggiunte e delle righe rimosse.
          title: Kind
          type: string
        negate:
          default: false
          description: Seleziona le pull request che non soddisfano la clausola.
          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: Una sessione Devin ha creato o preso in carico la pull request.
          title: Kind
          type: string
        negate:
          default: false
          description: Seleziona le pull request che non soddisfano la clausola.
          title: Negate
          type: boolean
        value:
          items:
            const: devin
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerOriginatedByClause
      type: object
    ReviewTriggerRepoVisibilityClause:
      additionalProperties: false
      properties:
        kind:
          const: repo_visibility
          description: >-
            Indica se il repository è pubblico o privato. Solo per gli ambiti
            organizzazione Git o prefisso.
          title: Kind
          type: string
        negate:
          default: false
          description: Individua le pull request che non soddisfano la clausola.
          title: Negate
          type: boolean
        value:
          items:
            enum:
              - public
              - private
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerRepoVisibilityClause
      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: Seleziona le pull request che non soddisfano la clausola.
          title: Negate
          type: boolean
        value:
          description: Nomi o pattern glob nel formato 'owner/repo'.
          items:
            type: string
          minItems: 1
          title: Value
          type: array
      required:
        - kind
        - value
      title: ReviewTriggerRepositoryClause
      type: object
    ReviewTriggerUser:
      additionalProperties: false
      properties:
        kind:
          description: >-
            `devin`: un membro dell'account identificato tramite ID utente e
            associato alle sue identità Git collegate; `scm`: un'identità Git.
          enum:
            - devin
            - scm
          title: Kind
          type: string
        value:
          minLength: 1
          title: Value
          type: string
      required:
        - kind
        - value
      title: ReviewTriggerUser
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Credenziale dell''utente del servizio (prefisso: cog_)'
      scheme: bearer
      type: http

````

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