Create, replace or delete default reviewer triggers
curl --request PATCH \
--url https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"deletes": [
{
"entity_id": "<string>",
"expected_version_id": "<string>"
}
],
"upserts": [
{
"conditions": {
"clauses": [
{
"users": [
{
"value": "<string>"
}
],
"negate": false
}
]
},
"entity_id": "<string>",
"expected_version_id": "<string>",
"repository": "<string>",
"user_id": "<string>"
}
]
}
'import requests
url = "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers"
payload = {
"deletes": [
{
"entity_id": "<string>",
"expected_version_id": "<string>"
}
],
"upserts": [
{
"conditions": { "clauses": [
{
"users": [{ "value": "<string>" }],
"negate": False
}
] },
"entity_id": "<string>",
"expected_version_id": "<string>",
"repository": "<string>",
"user_id": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
deletes: [{entity_id: '<string>', expected_version_id: '<string>'}],
upserts: [
{
conditions: {clauses: [{users: [{value: '<string>'}], negate: false}]},
entity_id: '<string>',
expected_version_id: '<string>',
repository: '<string>',
user_id: '<string>'
}
]
})
};
fetch('https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'deletes' => [
[
'entity_id' => '<string>',
'expected_version_id' => '<string>'
]
],
'upserts' => [
[
'conditions' => [
'clauses' => [
[
'users' => [
[
'value' => '<string>'
]
],
'negate' => false
]
]
],
'entity_id' => '<string>',
'expected_version_id' => '<string>',
'repository' => '<string>',
'user_id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers"
payload := strings.NewReader("{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"deleted_entity_ids": [
"<string>"
],
"upserted": [
{
"cadence": "once",
"conditions": {
"clauses": [
{
"kind": "author",
"users": [
{
"kind": "devin",
"value": "<string>"
}
],
"negate": false
}
],
"match": "all"
},
"created_at": 123,
"effort": "default",
"entity_id": "<string>",
"kind": "rule",
"modified_by_user_id": "<string>",
"readonly": true,
"removable": true,
"scope": {
"kind": "account",
"target": "<string>",
"user_id": "<string>"
},
"start": "pr_open",
"version_id": "<string>"
}
]
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Review Triggers (Organization) [Beta]
Update Devin Review triggers
Create, replace, and delete Devin Review auto-review rules and exclusions for an organization in one atomic API call.
PATCH
/
v3beta1
/
organizations
/
{org_id}
/
review-settings
/
default-reviewer
/
triggers
Create, replace or delete default reviewer triggers
curl --request PATCH \
--url https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"deletes": [
{
"entity_id": "<string>",
"expected_version_id": "<string>"
}
],
"upserts": [
{
"conditions": {
"clauses": [
{
"users": [
{
"value": "<string>"
}
],
"negate": false
}
]
},
"entity_id": "<string>",
"expected_version_id": "<string>",
"repository": "<string>",
"user_id": "<string>"
}
]
}
'import requests
url = "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers"
payload = {
"deletes": [
{
"entity_id": "<string>",
"expected_version_id": "<string>"
}
],
"upserts": [
{
"conditions": { "clauses": [
{
"users": [{ "value": "<string>" }],
"negate": False
}
] },
"entity_id": "<string>",
"expected_version_id": "<string>",
"repository": "<string>",
"user_id": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
deletes: [{entity_id: '<string>', expected_version_id: '<string>'}],
upserts: [
{
conditions: {clauses: [{users: [{value: '<string>'}], negate: false}]},
entity_id: '<string>',
expected_version_id: '<string>',
repository: '<string>',
user_id: '<string>'
}
]
})
};
fetch('https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'deletes' => [
[
'entity_id' => '<string>',
'expected_version_id' => '<string>'
]
],
'upserts' => [
[
'conditions' => [
'clauses' => [
[
'users' => [
[
'value' => '<string>'
]
],
'negate' => false
]
]
],
'entity_id' => '<string>',
'expected_version_id' => '<string>',
'repository' => '<string>',
'user_id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers"
payload := strings.NewReader("{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3beta1/organizations/{org_id}/review-settings/default-reviewer/triggers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deletes\": [\n {\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\"\n }\n ],\n \"upserts\": [\n {\n \"conditions\": {\n \"clauses\": [\n {\n \"users\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"negate\": false\n }\n ]\n },\n \"entity_id\": \"<string>\",\n \"expected_version_id\": \"<string>\",\n \"repository\": \"<string>\",\n \"user_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"deleted_entity_ids": [
"<string>"
],
"upserted": [
{
"cadence": "once",
"conditions": {
"clauses": [
{
"kind": "author",
"users": [
{
"kind": "devin",
"value": "<string>"
}
],
"negate": false
}
],
"match": "all"
},
"created_at": 123,
"effort": "default",
"entity_id": "<string>",
"kind": "rule",
"modified_by_user_id": "<string>",
"readonly": true,
"removable": true,
"scope": {
"kind": "account",
"target": "<string>",
"user_id": "<string>"
},
"start": "pr_open",
"version_id": "<string>"
}
]
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}Creates, replaces, and deletes Devin Review auto-review rules and exclusions in one atomic batch. To see existing triggers, use List Review triggers; to find the repositories you can target, use List Review trigger scopes.
Permissions
Requires a service user or personal access token with theManageReview 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
upsertswithoutentity_idcreates a trigger. Withentity_idit replaces that trigger and must includeexpected_version_id, theversion_idlast read. Fields you omit keep their stored values. kindisrule(run Review automatically) orexclusion(skip matching pull requests).scopeisaccount(every repository Review can see),repository(withrepositoryasowner/repoon github.com orhost/pathelsewhere), oruser(withuser_id, for that member’s own pull requests).- For rules,
startispr_openorpr_ready(default),cadenceisonceorevery_push(default), andeffortisdefault,normal, orultra. conditionsnarrows 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; sendnullto clear them.- Entries in
deletesname a trigger byentity_idandexpected_version_id. - The batch is all or nothing. It returns
400when empty,403when any entry targets a scope the caller can’t manage, and409when anexpected_version_idis stale. Read the triggers again and retry in the last case. - Returns
404when Review triggers are not enabled for the organization.
Example
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"
}
]
}'
Body
application/json

