Update Guardrail
curl --request PATCH \
--url https://api.enkryptai.com/guardrails/modify-guardrail \
--header 'Content-Type: application/json' \
--header 'X-Enkrypt-Guardrail: <x-enkrypt-guardrail>' \
--header 'apikey: <api-key>' \
--data '
{
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {},
"output": {}
}
'import requests
url = "https://api.enkryptai.com/guardrails/modify-guardrail"
payload = {
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {},
"output": {}
}
headers = {
"X-Enkrypt-Guardrail": "<x-enkrypt-guardrail>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'X-Enkrypt-Guardrail': '<x-enkrypt-guardrail>',
apikey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Guardrail',
description: 'Guardrail for production chatbot',
input: {},
output: {}
})
};
fetch('https://api.enkryptai.com/guardrails/modify-guardrail', 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.enkryptai.com/guardrails/modify-guardrail",
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' => 'My Guardrail',
'description' => 'Guardrail for production chatbot',
'input' => [
],
'output' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Enkrypt-Guardrail: <x-enkrypt-guardrail>",
"apikey: <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.enkryptai.com/guardrails/modify-guardrail"
payload := strings.NewReader("{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
req.Header.Add("apikey", "<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.enkryptai.com/guardrails/modify-guardrail")
.header("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/modify-guardrail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Enkrypt-Guardrail"] = '<x-enkrypt-guardrail>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "Guardrail details updated successfully",
"data": {
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": []
},
"injection_attack": {
"enabled": true,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"output": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": []
},
"injection_attack": {
"enabled": true,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"created_at": "2025-03-01T11:23:03.695943+00:00",
"updated_at": "2025-03-01T11:23:03.695943+00:00",
"policy_id": 1234567890,
"project_name": "default",
"created_by": "user@example.com",
"updated_by": "user@example.com",
"is_sample": false
}
}🛡️ Guardrails API Endpoints
Modify Guardrail
Update an existing guardrail
PATCH
/
guardrails
/
modify-guardrail
Update Guardrail
curl --request PATCH \
--url https://api.enkryptai.com/guardrails/modify-guardrail \
--header 'Content-Type: application/json' \
--header 'X-Enkrypt-Guardrail: <x-enkrypt-guardrail>' \
--header 'apikey: <api-key>' \
--data '
{
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {},
"output": {}
}
'import requests
url = "https://api.enkryptai.com/guardrails/modify-guardrail"
payload = {
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {},
"output": {}
}
headers = {
"X-Enkrypt-Guardrail": "<x-enkrypt-guardrail>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'X-Enkrypt-Guardrail': '<x-enkrypt-guardrail>',
apikey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Guardrail',
description: 'Guardrail for production chatbot',
input: {},
output: {}
})
};
fetch('https://api.enkryptai.com/guardrails/modify-guardrail', 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.enkryptai.com/guardrails/modify-guardrail",
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' => 'My Guardrail',
'description' => 'Guardrail for production chatbot',
'input' => [
],
'output' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Enkrypt-Guardrail: <x-enkrypt-guardrail>",
"apikey: <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.enkryptai.com/guardrails/modify-guardrail"
payload := strings.NewReader("{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
req.Header.Add("apikey", "<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.enkryptai.com/guardrails/modify-guardrail")
.header("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/modify-guardrail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Enkrypt-Guardrail"] = '<x-enkrypt-guardrail>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Guardrail\",\n \"description\": \"Guardrail for production chatbot\",\n \"input\": {},\n \"output\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "Guardrail details updated successfully",
"data": {
"name": "My Guardrail",
"description": "Guardrail for production chatbot",
"input": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": []
},
"injection_attack": {
"enabled": true,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"output": {
"topic_detector": {
"enabled": true,
"topic": [
"<string>"
],
"block_message": "<string>"
},
"nsfw": {
"enabled": true,
"block_message": "<string>"
},
"toxicity": {
"enabled": true,
"block_message": "<string>"
},
"pii": {
"enabled": true,
"entities": []
},
"injection_attack": {
"enabled": true,
"block_message": "<string>"
},
"keyword_detector": {
"enabled": true,
"banned_keywords": [
"<string>"
]
},
"system_prompt": {
"enabled": false,
"index": "system",
"block_message": "<string>"
},
"copyright_ip": {
"enabled": false,
"block_message": "<string>"
},
"policy_violation": {
"enabled": true,
"policy_text": "<string>",
"coc_policy_name": "<string>",
"need_explanation": true,
"block_message": "<string>"
},
"bias": {
"enabled": true
},
"sponge_attack": {
"enabled": false,
"block_message": "<string>"
}
},
"created_at": "2025-03-01T11:23:03.695943+00:00",
"updated_at": "2025-03-01T11:23:03.695943+00:00",
"policy_id": 1234567890,
"project_name": "default",
"created_by": "user@example.com",
"updated_by": "user@example.com",
"is_sample": false
}
}Authorizations
Headers
The guardrail name
Example:
"My Guardrail"
Body
application/json
The guardrail name
Example:
"My Guardrail"
Optional description of the guardrail
Example:
"Guardrail for production chatbot"
Detector configuration applied to input/prompt text
Show child attributes
Show child attributes
Detector configuration applied to output/response text
Show child attributes
Show child attributes
⌘I

