---
title: "Test Policy Template"
method: POST
path: "/policy/templates/test"
tags: ["policies"]
---

# Test Policy Template

`POST /policy/templates/test`

Test a policy template's guardrails against a text input without creating them.

Instantiates temporary guardrails from the template definitions, runs them
against the provided text, and returns per-guardrail results so users can
verify the template solves their problem before creating it.

## Request body

- TestPolicyTemplateRequest
  - `guardrail_definitions` object[], required — All guardrailDefinitions from the policy template
  - `text` string, required — Test input text to run guardrails against

## Response `200`

Successful Response

- TestPolicyTemplateResponse
  - `overall_action` string, required
  - `results` GuardrailTestResultEntry[], required
    - `action` string, required
    - `details` string, required
    - `guardrail_name` string, required
    - `output_text` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-19** `c357baf422ab` — 2 info
  - api tag `policies` added
  - api tag `policy management` removed
- **2026-09-18** `082b5fabd909` — 4 info
  - api tag `policy management` added
  - api tag `policies` removed
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status

[Change history](https://skmtc.dev/flock/apis/litellm-api/changes/policy/templates/test/post.md)

---

[API](https://skmtc.dev/flock/apis/litellm-api.md) · [All operations](https://skmtc.dev/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flock/apis/litellm-api/revisions/7ed45f30a5f0?raw)
