Edit Custom Rule
curl --request PATCH \
--url https://api.zerodrift.ai/api/policies/rules/{rule_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"fix_note": "<string>"
}
'import requests
url = "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
payload = {
"name": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"fix_note": "<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>',
action: '<string>',
severity: '<string>',
suggested_text: '<string>',
fix_note: '<string>'
})
};
fetch('https://api.zerodrift.ai/api/policies/rules/{rule_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.zerodrift.ai/api/policies/rules/{rule_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>',
'action' => '<string>',
'severity' => '<string>',
'suggested_text' => '<string>',
'fix_note' => '<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.zerodrift.ai/api/policies/rules/{rule_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<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.zerodrift.ai/api/policies/rules/{rule_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/rules/{rule_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 \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCustom Policies
Edit Custom Rule
Partially update an existing customer-owned custom rule
PATCH
/
api
/
policies
/
rules
/
{rule_id}
Edit Custom Rule
curl --request PATCH \
--url https://api.zerodrift.ai/api/policies/rules/{rule_id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"fix_note": "<string>"
}
'import requests
url = "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
payload = {
"name": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"fix_note": "<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>',
action: '<string>',
severity: '<string>',
suggested_text: '<string>',
fix_note: '<string>'
})
};
fetch('https://api.zerodrift.ai/api/policies/rules/{rule_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.zerodrift.ai/api/policies/rules/{rule_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>',
'action' => '<string>',
'severity' => '<string>',
'suggested_text' => '<string>',
'fix_note' => '<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.zerodrift.ai/api/policies/rules/{rule_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<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.zerodrift.ai/api/policies/rules/{rule_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/rules/{rule_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 \"action\": \"<string>\",\n \"severity\": \"<string>\",\n \"suggested_text\": \"<string>\",\n \"fix_note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPartially update an existing customer-owned
Type-specific fields match
Create Custom Rule
(
AI_SIGNAL, REGEX, or
REQUIRE_NEAR rule. Rule type and ownership metadata are immutable. Active
status is changed via
Activate Rules /
Deactivate Rules, not this
endpoint.
Requires a full-access API key. Supply only fields applicable to the stored
rule type.
Path Parameters
string
required
Custom rule identifier
Request Body
At least one field is required. Common editable fields:string
Human-readable rule name
string
fix or flagstring
do_not_send or send_with_cautionstring
Editable suggestion. Omit to preserve;
null clears and suppresses warning fallback.string
Remediation guidance. Nullable to clear.
prompt / keywords / window for AI_SIGNAL, regex_pattern for REGEX,
anchor / near / distance options for REQUIRE_NEAR).
Response
Returns the updated custom rule definition (same shape as Get Custom Rule).Errors
| Status | Meaning |
|---|---|
400 | Invalid custom rule update |
403 | Full-access API key required |
404 | Custom rule not found |
409 | Concurrent custom rule update |
Example
curl -X PATCH "https://api.zerodrift.ai/api/policies/rules/cust_abc123_no_misleading_claims" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"severity": "send_with_caution",
"suggested_text": "Past performance is not indicative of future results."
}'
⌘I

