Update Policy
curl --request PATCH \
--url https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"policy_type": "<string>",
"status": "<string>",
"priority": 500,
"rules": [
{
"condition": "<string>",
"value": "<string>"
}
],
"threat_types": [
"<string>"
],
"system_prompt_details": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}"
payload = {
"name": "<string>",
"description": "<string>",
"policy_type": "<string>",
"status": "<string>",
"priority": 500,
"rules": [
{
"condition": "<string>",
"value": "<string>"
}
],
"threat_types": ["<string>"],
"system_prompt_details": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
policy_type: '<string>',
status: '<string>',
priority: 500,
rules: [{condition: '<string>', value: '<string>'}],
threat_types: ['<string>'],
system_prompt_details: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/projects/{project_id}/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://api.promptguard.co/api/v1/projects/{project_id}/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>',
'policy_type' => '<string>',
'status' => '<string>',
'priority' => 500,
'rules' => [
[
'condition' => '<string>',
'value' => '<string>'
]
],
'threat_types' => [
'<string>'
],
'system_prompt_details' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "b2a7c1de-90f4-4a6e-8f5b-3c1d7e2a9f10",
"user_id": "6a1f0c3e-7d2b-4c58-9e0a-1b2c3d4e5f60",
"name": "No codenames",
"description": null,
"policy_type": "input_filter",
"status": "active",
"priority": 100,
"rules": [
{
"condition": "contains_text",
"action": "block",
"value": "Project Nightingale"
}
],
"threat_types": [],
"is_default": false,
"triggered_count": 0,
"project_id": "910b6423-8a12-4461-a6bf-9148d9b6b8e3",
"system_prompt_details": null,
"created_at": "2026-12-01T09:00:00Z",
"updated_at": "2026-12-01T09:00:00Z",
"enforced": true,
"warnings": []
}Update Policy
Change a policy. What is left out stays as it is.
With a CLI sign-in or a key marked for an agent, refused with
approval_required until your user approves it, unless it changes nothing.
Guide: Configure a project
PATCH
/
api
/
v1
/
projects
/
{project_id}
/
policies
/
{policy_id}
Update Policy
curl --request PATCH \
--url https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"policy_type": "<string>",
"status": "<string>",
"priority": 500,
"rules": [
{
"condition": "<string>",
"value": "<string>"
}
],
"threat_types": [
"<string>"
],
"system_prompt_details": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}"
payload = {
"name": "<string>",
"description": "<string>",
"policy_type": "<string>",
"status": "<string>",
"priority": 500,
"rules": [
{
"condition": "<string>",
"value": "<string>"
}
],
"threat_types": ["<string>"],
"system_prompt_details": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
policy_type: '<string>',
status: '<string>',
priority: 500,
rules: [{condition: '<string>', value: '<string>'}],
threat_types: ['<string>'],
system_prompt_details: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/projects/{project_id}/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://api.promptguard.co/api/v1/projects/{project_id}/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>',
'policy_type' => '<string>',
'status' => '<string>',
'priority' => 500,
'rules' => [
[
'condition' => '<string>',
'value' => '<string>'
]
],
'threat_types' => [
'<string>'
],
'system_prompt_details' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/projects/{project_id}/policies/{policy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"policy_type\": \"<string>\",\n \"status\": \"<string>\",\n \"priority\": 500,\n \"rules\": [\n {\n \"condition\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"threat_types\": [\n \"<string>\"\n ],\n \"system_prompt_details\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "b2a7c1de-90f4-4a6e-8f5b-3c1d7e2a9f10",
"user_id": "6a1f0c3e-7d2b-4c58-9e0a-1b2c3d4e5f60",
"name": "No codenames",
"description": null,
"policy_type": "input_filter",
"status": "active",
"priority": 100,
"rules": [
{
"condition": "contains_text",
"action": "block",
"value": "Project Nightingale"
}
],
"threat_types": [],
"is_default": false,
"triggered_count": 0,
"project_id": "910b6423-8a12-4461-a6bf-9148d9b6b8e3",
"system_prompt_details": null,
"created_at": "2026-12-01T09:00:00Z",
"updated_at": "2026-12-01T09:00:00Z",
"enforced": true,
"warnings": []
}Authorizations
Headers
Body
application/json
A change to a policy, which stays on its project.
Response
Successful Response
Policy response schema