更新 Devin CLI 团队权限规则
curl --request PUT \
--url https://server.codeium.com/api/v2alpha/cli-permissions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"allow": [
"<string>"
],
"ask": [
"<string>"
],
"deny": [
"<string>"
]
}
'import requests
url = "https://server.codeium.com/api/v2alpha/cli-permissions"
payload = {
"allow": ["<string>"],
"ask": ["<string>"],
"deny": ["<string>"]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({allow: ['<string>'], ask: ['<string>'], deny: ['<string>']})
};
fetch('https://server.codeium.com/api/v2alpha/cli-permissions', 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://server.codeium.com/api/v2alpha/cli-permissions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allow' => [
'<string>'
],
'ask' => [
'<string>'
],
'deny' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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://server.codeium.com/api/v2alpha/cli-permissions"
payload := strings.NewReader("{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
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.put("https://server.codeium.com/api/v2alpha/cli-permissions")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v2alpha/cli-permissions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAPI 参考文档
更新 Devin CLI 团队权限规则
通过 API 替换您团队的账户级 Devin CLI 权限规则(允许、询问和拒绝),并通过 ETag 实现并发控制。
PUT
/
api
/
v2alpha
/
cli-permissions
更新 Devin CLI 团队权限规则
curl --request PUT \
--url https://server.codeium.com/api/v2alpha/cli-permissions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"allow": [
"<string>"
],
"ask": [
"<string>"
],
"deny": [
"<string>"
]
}
'import requests
url = "https://server.codeium.com/api/v2alpha/cli-permissions"
payload = {
"allow": ["<string>"],
"ask": ["<string>"],
"deny": ["<string>"]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({allow: ['<string>'], ask: ['<string>'], deny: ['<string>']})
};
fetch('https://server.codeium.com/api/v2alpha/cli-permissions', 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://server.codeium.com/api/v2alpha/cli-permissions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allow' => [
'<string>'
],
'ask' => [
'<string>'
],
'deny' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$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://server.codeium.com/api/v2alpha/cli-permissions"
payload := strings.NewReader("{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
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.put("https://server.codeium.com/api/v2alpha/cli-permissions")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v2alpha/cli-permissions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allow\": [\n \"<string>\"\n ],\n \"ask\": [\n \"<string>\"\n ],\n \"deny\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body概述
替换你团队的账户级 Devin CLI 权限规则,即在团队设置中配置的终端权限。 为避免覆盖他人同时进行的更改,请在If-Match 标头中传入通过 Get CLI Permissions 获取的 ETag。如果规则在此期间已被更改,请求将失败并返回 412。
此端点目前处于 alpha 阶段 (
v2alpha) ,请求和响应的结构可能会有所变化。身份验证
在Authorization 标头中传入 Devin 服务用户 API 密钥 (cog_...) :
Authorization: Bearer <api-key>
403。
请求
这三个字段均为必填,包含未知字段的请求将被拒绝。每条规则都必须遵循 Devin CLI 权限语法;如有无法解析的规则,将返回400。此端点不会校验 Fetch(...) 的 URL 模式——Devin CLI 会忽略无法编译的模式。
请求示例
ETAG=$(curl -s -D - -o /dev/null https://server.codeium.com/api/v2alpha/cli-permissions \
-H "Authorization: Bearer $DEVIN_API_KEY" | awk 'tolower($1)=="etag:" {print $2}' | tr -d '\r')
curl -X PUT https://server.codeium.com/api/v2alpha/cli-permissions \
-H "Authorization: Bearer $DEVIN_API_KEY" \
-H "If-Match: $ETAG" \
-H "Content-Type: application/json" \
-d '{"allow": ["Exec(git)", "Read(**)"], "ask": ["Fetch(domain:*)"], "deny": ["ExecExact(rm -rf /)"]}'
响应
返回更新后的allow、ask 和 deny 列表及新的 ETag 标头,格式与Get CLI Permissions一致。更新成功后,会记录到团队审计日志中。
错误响应
错误以{"error": "<message>"} 格式返回。
| 状态 | 原因 |
|---|---|
400 | JSON 无效、包含未知字段、缺少 allow、ask 或 deny,或权限规则无法解析 |
401 | API 密钥缺失或无效,或使用了旧版 Windsurf API 密钥 (仅接受 Devin cog_... 服务用户密钥) |
403 | 使用了个人令牌而非服务用户密钥、缺少 Devin Desktop 访问权限或 account.windsurf.admin 权限,或账户未订阅团队或 Enterprise 套餐 |
412 | If-Match 与当前 ETag 不匹配;请重新获取规则后重试 |
428 | 缺少 If-Match 标头 |
429 | 超出速率限制;请按 Retry-After 标头指定的时间等待后重试 |

