Update Policy
curl --request PATCH \
--url https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"support_contact": "<string>",
"tags": [
"<string>"
],
"application_ids": [
"<string>"
],
"rules": [
{
"name": "",
"authorized": false,
"actions": [
"<string>"
],
"roles_groups": [
"<string>"
],
"condition": {
"match": {
"expr": "<string>"
}
}
}
]
}
'import requests
url = "https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}"
payload = {
"name": "<string>",
"description": "<string>",
"support_contact": "<string>",
"tags": ["<string>"],
"application_ids": ["<string>"],
"rules": [
{
"name": "",
"authorized": False,
"actions": ["<string>"],
"roles_groups": ["<string>"],
"condition": { "match": { "expr": "<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({
name: '<string>',
description: '<string>',
support_contact: '<string>',
tags: ['<string>'],
application_ids: ['<string>'],
rules: [
{
name: '',
authorized: false,
actions: ['<string>'],
roles_groups: ['<string>'],
condition: {match: {expr: '<string>'}}
}
]
})
};
fetch('https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}', 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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}",
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([
'name' => '<string>',
'description' => '<string>',
'support_contact' => '<string>',
'tags' => [
'<string>'
],
'application_ids' => [
'<string>'
],
'rules' => [
[
'name' => '',
'authorized' => false,
'actions' => [
'<string>'
],
'roles_groups' => [
'<string>'
],
'condition' => [
'match' => [
'expr' => '<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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}")
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 \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"policy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_id": "<string>",
"name": "<string>",
"status": "<string>",
"mcp_server_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>",
"updated_by_user_id": "<string>",
"support_contact": "<string>",
"description": "<string>",
"application_ids": [
"<string>"
],
"tags": [
"<string>"
],
"rules": [
{
"name": "",
"authorized": false,
"actions": [
"<string>"
],
"roles_groups": [
"<string>"
],
"condition": {
"match": {
"expr": "<string>"
}
}
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Policies
Update Policy
PATCH
/
api
/
v2
/
policies
/
{policy_id}
Update Policy
curl --request PATCH \
--url https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"support_contact": "<string>",
"tags": [
"<string>"
],
"application_ids": [
"<string>"
],
"rules": [
{
"name": "",
"authorized": false,
"actions": [
"<string>"
],
"roles_groups": [
"<string>"
],
"condition": {
"match": {
"expr": "<string>"
}
}
}
]
}
'import requests
url = "https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}"
payload = {
"name": "<string>",
"description": "<string>",
"support_contact": "<string>",
"tags": ["<string>"],
"application_ids": ["<string>"],
"rules": [
{
"name": "",
"authorized": False,
"actions": ["<string>"],
"roles_groups": ["<string>"],
"condition": { "match": { "expr": "<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({
name: '<string>',
description: '<string>',
support_contact: '<string>',
tags: ['<string>'],
application_ids: ['<string>'],
rules: [
{
name: '',
authorized: false,
actions: ['<string>'],
roles_groups: ['<string>'],
condition: {match: {expr: '<string>'}}
}
]
})
};
fetch('https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}', 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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}",
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([
'name' => '<string>',
'description' => '<string>',
'support_contact' => '<string>',
'tags' => [
'<string>'
],
'application_ids' => [
'<string>'
],
'rules' => [
[
'name' => '',
'authorized' => false,
'actions' => [
'<string>'
],
'roles_groups' => [
'<string>'
],
'condition' => [
'match' => [
'expr' => '<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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\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://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{organization_id}.platform.barndoor.ai/api/v2/policies/{policy_id}")
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 \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"support_contact\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"application_ids\": [\n \"<string>\"\n ],\n \"rules\": [\n {\n \"name\": \"\",\n \"authorized\": false,\n \"actions\": [\n \"<string>\"\n ],\n \"roles_groups\": [\n \"<string>\"\n ],\n \"condition\": {\n \"match\": {\n \"expr\": \"<string>\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"policy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_id": "<string>",
"name": "<string>",
"status": "<string>",
"mcp_server_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>",
"updated_by_user_id": "<string>",
"support_contact": "<string>",
"description": "<string>",
"application_ids": [
"<string>"
],
"tags": [
"<string>"
],
"rules": [
{
"name": "",
"authorized": false,
"actions": [
"<string>"
],
"roles_groups": [
"<string>"
],
"condition": {
"match": {
"expr": "<string>"
}
}
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Accepts a partial policy object. Send only the fields you are changing;
rules is replaced wholesale when present, so include the complete rule set rather than a delta.
Tool-call actions inside rules[].actions use the same two forms as on create — tools/call:<tool> for an outright grant and tools/call:<tool>:approve to require user approval. See Create Policy → Tool-call actions.
For a comprehensive guide, see Managing Policies.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Request body for partial updates to an existing policy.
Human-friendly policy name, unique within an organization
Longer description of the policy.
Primary point of contact associated with the policy.
Tags for categorizing the policy.
The current lifecycle status of the policy.
Available options:
DRAFT, ACTIVE, INACTIVE, ARCHIVED List of application (agent) identifiers to which this policy applies.
Full set of rules that govern the policy.
Show child attributes
Show child attributes
Response
Successful Response
Envelope for detail responses.
Detailed representation of a policy including rules.
Show child attributes
Show child attributes