Example request:
Example response:
JSON
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import requests
import json
import os
url = "https://api.enkryptai.com/guardrails/detect"
payload = json.dumps({
"text": "This movie scene is too explicit and contains adult dialogue that might not be suitable for all audiences.",
"detectors": {
"nsfw": {
"enabled": True,
"block_message": "Your custom message"
},
}
})
headers = {
'Content-Type': 'application/json',
'apikey': os.getenv('ENKRYPTAI_API_KEY')
}
response = requests.request("POST", url, headers=headers, data=payload)
formatted_response = json.dumps(json.loads(response.text), indent=4)
print(formatted_response)
import os
from enkryptai_sdk import *
from dotenv import load_dotenv
load_dotenv()
ENKRYPT_API_KEY = os.getenv("ENKRYPTAI_API_KEY")
ENKRYPT_BASE_URL = os.getenv("ENKRYPTAI_BASE_URL") or "https://api.enkryptai.com"
guardrails_client = GuardrailsClient(api_key=ENKRYPT_API_KEY, base_url=ENKRYPT_BASE_URL)
guardrails_config = GuardrailsConfig.nsfw()
prompt = "This movie scene is too explicit and contains adult dialogue that might not be suitable for all audiences."
detect_response = guardrails_client.detect(text=prompt, guardrails_config=guardrails_config)
print(detect_response)
# Print as a dictionary
print(detect_response.to_dict())
{
"summary": {
"nsfw": 1
},
"details": {
"nsfw": {
"sfw": 0.18349984288215637,
"nsfw": 0.8089521527290344,
"compliance_mapping": {
"owasp_llm_2025": [
"LLM05:2025 Improper Output Handling"
],
"mitre_atlas": [],
"nist_ai_rmf": [
"MANAGE 2.3 (Content filtering & harmful output prevention)"
],
"eu_ai_act": [
"Article 50(2) (Restrictions on prohibited practices)"
],
"iso_iec_standards": [
"ISO/IEC 42001: 6.4.3 (Managing prohibited outputs)"
]
}
}
},
"result_message": "Your custom message"
}
