Get Guardrail
curl --request GET \
--url https://api.enkryptai.com/guardrails/get-guardrail \
--header 'X-Enkrypt-Guardrail: <x-enkrypt-guardrail>' \
--header 'apikey: <api-key>'import requests
url = "https://api.enkryptai.com/guardrails/get-guardrail"
headers = {
"X-Enkrypt-Guardrail": "<x-enkrypt-guardrail>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Enkrypt-Guardrail': '<x-enkrypt-guardrail>', apikey: '<api-key>'}
};
fetch('https://api.enkryptai.com/guardrails/get-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/get-guardrail",
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-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"
"net/http"
"io"
)
func main() {
url := "https://api.enkryptai.com/guardrails/get-guardrail"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
req.Header.Add("apikey", "<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.enkryptai.com/guardrails/get-guardrail")
.header("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/get-guardrail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Enkrypt-Guardrail"] = '<x-enkrypt-guardrail>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"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
Get Guardrail
Retrieve a guardrail by name
GET
/
guardrails
/
get-guardrail
Get Guardrail
curl --request GET \
--url https://api.enkryptai.com/guardrails/get-guardrail \
--header 'X-Enkrypt-Guardrail: <x-enkrypt-guardrail>' \
--header 'apikey: <api-key>'import requests
url = "https://api.enkryptai.com/guardrails/get-guardrail"
headers = {
"X-Enkrypt-Guardrail": "<x-enkrypt-guardrail>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Enkrypt-Guardrail': '<x-enkrypt-guardrail>', apikey: '<api-key>'}
};
fetch('https://api.enkryptai.com/guardrails/get-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/get-guardrail",
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-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"
"net/http"
"io"
)
func main() {
url := "https://api.enkryptai.com/guardrails/get-guardrail"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
req.Header.Add("apikey", "<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.enkryptai.com/guardrails/get-guardrail")
.header("X-Enkrypt-Guardrail", "<x-enkrypt-guardrail>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/get-guardrail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Enkrypt-Guardrail"] = '<x-enkrypt-guardrail>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"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"
Refresh the cache if data is stale
Example:
false
Response
200 - application/json
Successful Response
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
Example:
"2025-03-01T11:23:03.695943+00:00"
Example:
"2025-03-01T11:23:03.695943+00:00"
Example:
1234567890
Example:
"default"
Example:
"user@example.com"
Example:
"user@example.com"
Example:
false
⌘I

