Guardrail templates
/v1/guardrail-templates — list the templates, and preview what one would do to a draft policy.
A guardrail template is a named set of policy settings for one industry and one audience. These endpoints let code do what Choose a template does in the dashboard: see the templates, and see what applying one to a draft would change.
Nothing here saves anything. To save the result, send the returned config to POST /v1/guardrail-policies.
Which keys can call them
| Key scope | List | Preview |
|---|---|---|
full | Yes | Yes |
read, run_read | Yes | No. Preview is a POST, and these scopes can only read. |
runtime | No | No |
List the templates
GET https://api.liyaengine.ai/v1/guardrail-templates
Authorization: Bearer liya_prod_...{
"success": true,
"data": {
"templates": [
{
"id": "healthcare-member",
"industry": "healthcare",
"audience": "customer",
"name": "Healthcare · member facing",
"description": "For assistants that talk to members and patients. No clinical advice, personal details redacted, answers grounded.",
"settings": [
{ "id": "injection_mode", "label": "How injection is judged", "value": "Balanced" },
{ "id": "pii_mode", "label": "PII mode", "value": "Redact" },
{ "id": "grounding", "label": "Knowledge grounding", "value": "Block" }
],
"topics": [
"tell me how much medication to take",
"should i stop taking my medication",
"diagnose my symptoms",
"explain what my lab numbers mean for my health"
],
"reply_hint": "Point to your nurse line, and to emergency services for an emergency.",
"workspace_settings": ["redact_healthcare_identifiers"]
}
]
}
}The example is shortened: each template lists every setting it sets, and there are six templates. These are their ids:
| Id | Industry | Audience |
|---|---|---|
general-customer | general | customer |
general-staff | general | staff |
financial-customer | financial_services | customer |
financial-staff | financial_services | staff |
healthcare-member | healthcare | customer |
healthcare-staff | healthcare | staff |
| Field | Meaning |
|---|---|
settings | The settings the template sets, with the value it gives each, in the words the dashboard uses. |
topics | Blocked topics it adds to the policy's own. Empty for most templates. |
reply_hint | What the reply to a blocked topic should say. A template never writes the reply itself. null when the template adds no topics. |
workspace_settings | Workspace settings it recommends. They are not part of a policy and applying a template does not change them. |
Preview a template on a draft
POST https://api.liyaengine.ai/v1/guardrail-templates/financial-customer/preview
Authorization: Bearer liya_prod_...
Content-Type: application/json
{
"config": {
"pre_llm": {
"content_policy": {
"blocked_topics": ["competitor pricing"],
"blocked_topic_message": "Call us on 1-800-555-0100."
}
}
}
}config is required. It is the draft policy the template is applied to, and an empty object {} is a valid draft. Settings left out take their defaults, as they do when a policy is saved.
{
"success": true,
"data": {
"preview": {
"template_id": "financial-customer",
"config": { "pre_llm": { "...": "the whole draft, with the template applied" } },
"changes": [
{ "id": "injection_mode", "label": "How injection is judged", "from": "Standard", "to": "Balanced" },
{ "id": "ml_unavailable", "label": "If the checking service is down", "from": "Allow", "to": "Flag" },
{ "id": "scan_input_fields", "label": "Scan every input field", "from": "Off", "to": "On" },
{ "id": "harden_prompt", "label": "Treat values as data", "from": "Off", "to": "On" },
{ "id": "profanity_filter", "label": "Profanity filter", "from": "Blocks", "to": "Allows" }
],
"already_set": 3,
"topics_added": [
"how to launder money",
"how to split deposits to avoid reporting requirements",
"..."
],
"topics_already_blocked": []
}
}
}| Field | Meaning |
|---|---|
config | The draft with the template applied. Save this. |
changes | Only the settings that differ from the draft you sent. |
already_set | How many of the template's settings the draft already had. |
topics_added | Blocked topics added to the draft's own. |
topics_already_blocked | Topics the template would add that the draft already blocks. They are not added twice. |
Your draft's own blocked topics and its blocked_topic_message come back unchanged in config, along with its size limit, skipped input fields, allowed actions and output checks. Previewing the returned config with the same template again gives an empty changes list.
Errors
| Status | Code | When |
|---|---|---|
| 400 | INVALID_INPUT | config is missing, or is not a valid policy (for example "injection_mode": "sometimes"). The message names the first problem. |
| 404 | TEMPLATE_NOT_FOUND | There is no template with that id. List the ids with GET /v1/guardrail-templates. |
| 403 | API_KEY_SCOPE_DENIED | The key's scope does not allow the request (see the table at the top). |