LiyaEngine Docs

Guardrail templates

/v1/guardrail-templates — list the templates, and preview what one would do to a draft policy.

Dashboard

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 scopeListPreview
fullYesYes
read, run_readYesNo. Preview is a POST, and these scopes can only read.
runtimeNoNo

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:

IdIndustryAudience
general-customergeneralcustomer
general-staffgeneralstaff
financial-customerfinancial_servicescustomer
financial-stafffinancial_servicesstaff
healthcare-memberhealthcarecustomer
healthcare-staffhealthcarestaff
FieldMeaning
settingsThe settings the template sets, with the value it gives each, in the words the dashboard uses.
topicsBlocked topics it adds to the policy's own. Empty for most templates.
reply_hintWhat the reply to a blocked topic should say. A template never writes the reply itself. null when the template adds no topics.
workspace_settingsWorkspace 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": []
    }
  }
}
FieldMeaning
configThe draft with the template applied. Save this.
changesOnly the settings that differ from the draft you sent.
already_setHow many of the template's settings the draft already had.
topics_addedBlocked topics added to the draft's own.
topics_already_blockedTopics 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

StatusCodeWhen
400INVALID_INPUTconfig is missing, or is not a valid policy (for example "injection_mode": "sometimes"). The message names the first problem.
404TEMPLATE_NOT_FOUNDThere is no template with that id. List the ids with GET /v1/guardrail-templates.
403API_KEY_SCOPE_DENIEDThe key's scope does not allow the request (see the table at the top).

On this page