Get Custom Rule
curl --request GET \
--url https://api.zerodrift.ai/api/policies/rules/{rule_id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.zerodrift.ai/api/policies/rules/{rule_id}")
.header("x-api-key", "<api-key>")
.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::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"rule_id": "<string>",
"name": "<string>",
"type": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"source": "<string>",
"active": true,
"fix_note": "<string>",
"prompt": "<string>",
"keywords": [
{}
],
"window": "<string>",
"regex_pattern": "<string>",
"anchor": "<string>",
"near": [
{}
],
"distance_chars": 123,
"direction": "<string>",
"case_insensitive": true,
"mode": "<string>",
"min_hits": 123,
"import_id": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}Policy
Get Custom Rule
Return the full editable definition for a customer-owned custom rule
GET
/
api
/
policies
/
rules
/
{rule_id}
Get Custom Rule
curl --request GET \
--url https://api.zerodrift.ai/api/policies/rules/{rule_id} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
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 => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.zerodrift.ai/api/policies/rules/{rule_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.zerodrift.ai/api/policies/rules/{rule_id}")
.header("x-api-key", "<api-key>")
.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::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"rule_id": "<string>",
"name": "<string>",
"type": "<string>",
"action": "<string>",
"severity": "<string>",
"suggested_text": "<string>",
"source": "<string>",
"active": true,
"fix_note": "<string>",
"prompt": "<string>",
"keywords": [
{}
],
"window": "<string>",
"regex_pattern": "<string>",
"anchor": "<string>",
"near": [
{}
],
"distance_chars": 123,
"direction": "<string>",
"case_insensitive": true,
"mode": "<string>",
"min_hits": 123,
"import_id": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}Return the full editable definition for a customer-owned custom rule.
Path Parameters
string
required
Custom rule identifier (typically prefixed with
cust_)Response
string
Rule identifier
string
Human-readable rule name
string
AI_SIGNAL, REGEX, or REQUIRE_NEARstring
fix or flagstring
do_not_send or send_with_cautionstring
Stored suggested replacement or warning guidance when present
string
Always
customboolean
Whether the rule currently runs during validation
string
Remediation guidance when present
string
AI instruction (
AI_SIGNAL only)array
Keyword gate (
AI_SIGNAL only)string
sentence, paragraph, or document (AI_SIGNAL only)string
Regex pattern (
REGEX only)string
Anchor regex (
REQUIRE_NEAR only)array
Near-pattern regexes (
REQUIRE_NEAR only)integer
Character distance (
REQUIRE_NEAR)string
before, after, or either (REQUIRE_NEAR)boolean
Case-insensitive matching (
REQUIRE_NEAR)string
document or page (REQUIRE_NEAR)integer
Minimum near hits (
REQUIRE_NEAR)string
Source import ID when the rule was created via policy import
string
ISO 8601 creation timestamp
string
ISO 8601 last-update timestamp when present
Errors
| Status | Meaning |
|---|---|
403 | Forbidden |
404 | Custom rule not found |

