Activate Rules
curl --request POST \
--url https://api.zerodrift.ai/api/policies/import/{import_id}/activate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"rule_ids": [
{}
],
"overwrite": true
}
'import requests
url = "https://api.zerodrift.ai/api/policies/import/{import_id}/activate"
payload = {
"rule_ids": [{}],
"overwrite": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({rule_ids: [{}], overwrite: true})
};
fetch('https://api.zerodrift.ai/api/policies/import/{import_id}/activate', 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/import/{import_id}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rule_ids' => [
[
]
],
'overwrite' => true
]),
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/import/{import_id}/activate"
payload := strings.NewReader("{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.zerodrift.ai/api/policies/import/{import_id}/activate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/import/{import_id}/activate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}"
response = http.request(request)
puts response.read_body{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "activated",
"activated_count": 5,
"activated_rule_ids": [
"cust_abc123_no_misleading_claims",
"cust_abc123_benchmark_comparison_required",
"cust_abc123_risk_disclosure_present",
"cust_abc123_fee_transparency",
"cust_abc123_past_performance_disclaimer"
]
}
{
"error": "No matching rule_ids found in import"
}
{
"error": "Rule 'cust_abc123_no_misleading_claims' was created by a concurrent request",
"conflicting_rule_id": "cust_abc123_no_misleading_claims",
"activated_rule_ids": [
"cust_abc123_benchmark_comparison_required"
]
}
Policy
Activate Rules
Activate extracted rules from a policy import so they run during validation
POST
/
api
/
policies
/
import
/
{import_id}
/
activate
Activate Rules
curl --request POST \
--url https://api.zerodrift.ai/api/policies/import/{import_id}/activate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"rule_ids": [
{}
],
"overwrite": true
}
'import requests
url = "https://api.zerodrift.ai/api/policies/import/{import_id}/activate"
payload = {
"rule_ids": [{}],
"overwrite": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({rule_ids: [{}], overwrite: true})
};
fetch('https://api.zerodrift.ai/api/policies/import/{import_id}/activate', 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/import/{import_id}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rule_ids' => [
[
]
],
'overwrite' => true
]),
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/import/{import_id}/activate"
payload := strings.NewReader("{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.zerodrift.ai/api/policies/import/{import_id}/activate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/import/{import_id}/activate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule_ids\": [\n {}\n ],\n \"overwrite\": true\n}"
response = http.request(request)
puts response.read_body{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "activated",
"activated_count": 5,
"activated_rule_ids": [
"cust_abc123_no_misleading_claims",
"cust_abc123_benchmark_comparison_required",
"cust_abc123_risk_disclosure_present",
"cust_abc123_fee_transparency",
"cust_abc123_past_performance_disclaimer"
]
}
{
"error": "No matching rule_ids found in import"
}
{
"error": "Rule 'cust_abc123_no_misleading_claims' was created by a concurrent request",
"conflicting_rule_id": "cust_abc123_no_misleading_claims",
"activated_rule_ids": [
"cust_abc123_benchmark_comparison_required"
]
}
Activate rules extracted from a policy import. Once activated, these rules will be enforced during document validation for your account. You can activate all rules or a specific subset.
This is also the activation step for a document synced from Notion, Linear, Confluence, or Google Drive. After Command shows the import as pending review, call this endpoint with that
import_id. Re-syncing the same source document refreshes the existing policy rather than creating a second one — see Connecting the MCP server.
Activated rules apply automatically on every validation
made with your API key — there is no per-request flag to select them, and
document_category /
document_metadata do not control them (those only select ZeroDrift’s built-in default rules).
Use Deactivate Rules to stop a rule from running.
After activation, you can train a policy-specific adapter for this import.Path Parameters
string
required
The import ID to activate rules from
Request Body
array
Optional list of specific rule IDs to activate. If omitted, all extracted rules are activated.
boolean
Set to
true to overwrite rules that have already been activated from a previous import. Defaults to false.When
overwrite is false (default), if a rule ID already exists the request stops and returns a 409 conflict response. The 409 error body includes an error message that identifies the conflicting rule ID and indicates which rules were successfully activated before the collision. Use overwrite: true to replace existing rules unconditionally.Response
string
Import identifier
string
Updated import status:
activatedinteger
Number of rules successfully activated
array
List of activated rule IDs (prefixed with
cust_<customer_id>_)string
For
409 responses, the rule ID that caused the conflict.{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "activated",
"activated_count": 5,
"activated_rule_ids": [
"cust_abc123_no_misleading_claims",
"cust_abc123_benchmark_comparison_required",
"cust_abc123_risk_disclosure_present",
"cust_abc123_fee_transparency",
"cust_abc123_past_performance_disclaimer"
]
}
{
"error": "No matching rule_ids found in import"
}
{
"error": "Rule 'cust_abc123_no_misleading_claims' was created by a concurrent request",
"conflicting_rule_id": "cust_abc123_no_misleading_claims",
"activated_rule_ids": [
"cust_abc123_benchmark_comparison_required"
]
}
Example
Two request shapes: activate every extracted rule, or activate a subset withrule_ids and overwrite.
curl -X POST "https://api.zerodrift.ai/api/policies/import/550e8400-e29b-41d4-a716-446655440000/activate" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json"
curl -X POST "https://api.zerodrift.ai/api/policies/import/550e8400-e29b-41d4-a716-446655440000/activate" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rule_ids": ["no_misleading_claims", "risk_disclosure_present"],
"overwrite": true
}'
import requests
API_KEY = "YOUR_API_KEY"
API_BASE = "https://api.zerodrift.ai"
IMPORT_ID = "550e8400-e29b-41d4-a716-446655440000"
# Activate all rules
response = requests.post(
f"{API_BASE}/api/policies/import/{IMPORT_ID}/activate",
headers={
"x-api-key": API_KEY,
"Content-Type": "application/json"
}
)
result = response.json()
print(f"Activated {result['activated_count']} rules")
for rule_id in result["activated_rule_ids"]:
print(f" - {rule_id}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const API_BASE = 'https://api.zerodrift.ai';
const IMPORT_ID = '550e8400-e29b-41d4-a716-446655440000';
// Activate specific rules
const response = await axios.post(
`${API_BASE}/api/policies/import/${IMPORT_ID}/activate`,
{
rule_ids: ['no_misleading_claims', 'risk_disclosure_present'],
overwrite: true
},
{
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
}
}
);
console.log(`Activated ${response.data.activated_count} rules`);
response.data.activated_rule_ids.forEach(id => console.log(` - ${id}`));

