Get Policy
curl --request GET \
--url https://api.enkryptai.com/guardrails/get-policy \
--header 'X-Enkrypt-Policy: <x-enkrypt-policy>' \
--header 'apikey: <api-key>'import requests
url = "https://api.enkryptai.com/guardrails/get-policy"
headers = {
"X-Enkrypt-Policy": "<x-enkrypt-policy>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Enkrypt-Policy': '<x-enkrypt-policy>', apikey: '<api-key>'}
};
fetch('https://api.enkryptai.com/guardrails/get-policy', 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-policy",
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-Policy: <x-enkrypt-policy>",
"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-policy"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Enkrypt-Policy", "<x-enkrypt-policy>")
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-policy")
.header("X-Enkrypt-Policy", "<x-enkrypt-policy>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/get-policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Enkrypt-Policy"] = '<x-enkrypt-policy>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"description": "<string>",
"detectors": {
"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": "2024-10-07T11:23:03.695943+00:00",
"updated_at": "2024-10-07T11:23:03.695943+00:00",
"policy_id": 1234567890,
"project_name": "default"
}Guardrails Policy (Legacy)
Get Policy (Legacy)
deprecated
Retrieve a policy by name
GET
/
guardrails
/
get-policy
Get Policy
curl --request GET \
--url https://api.enkryptai.com/guardrails/get-policy \
--header 'X-Enkrypt-Policy: <x-enkrypt-policy>' \
--header 'apikey: <api-key>'import requests
url = "https://api.enkryptai.com/guardrails/get-policy"
headers = {
"X-Enkrypt-Policy": "<x-enkrypt-policy>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Enkrypt-Policy': '<x-enkrypt-policy>', apikey: '<api-key>'}
};
fetch('https://api.enkryptai.com/guardrails/get-policy', 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-policy",
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-Policy: <x-enkrypt-policy>",
"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-policy"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Enkrypt-Policy", "<x-enkrypt-policy>")
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-policy")
.header("X-Enkrypt-Policy", "<x-enkrypt-policy>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enkryptai.com/guardrails/get-policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Enkrypt-Policy"] = '<x-enkrypt-policy>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"name": "<string>",
"description": "<string>",
"detectors": {
"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": "2024-10-07T11:23:03.695943+00:00",
"updated_at": "2024-10-07T11:23:03.695943+00:00",
"policy_id": 1234567890,
"project_name": "default"
}Archived: This endpoint is legacy. Use the new Get Guardrail endpoint instead, which supports separate input/output detector configurations.
Authorizations
Headers
The policy name
Example:
"Test Guardrails Policy"
Refresh the cache if data is stale
Example:
false
Response
200 - application/json
Successful Response
Show child attributes
Show child attributes
Example:
"2024-10-07T11:23:03.695943+00:00"
Example:
"2024-10-07T11:23:03.695943+00:00"
Example:
1234567890
Example:
"default"
โI

