---
title: "Apply Guardrail"
method: POST
path: "/apply_guardrail"
tags: ["guardrails"]
---

# Apply Guardrail

`POST /apply_guardrail`

Apply a guardrail to text input and return the processed result.

This endpoint allows testing guardrails by applying them to custom text inputs.

## Request body

- ApplyGuardrailRequest
  - `entities` PiiEntityType[], nullable
  - `guardrail_name` string, required
  - `input_type` string
  - `language` string, nullable
  - `messages` object[], nullable
  - `metadata` object, nullable
  - `text` string, required

## Response `200`

Successful Response

- ApplyGuardrailResponse
  - `response_text` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-27** `b694deb1e459` — 1 info
  - api tag `guardrails` added
- **2026-09-26** `cfac079bcc04` — 1 info
  - api tag `guardrails` removed
- **2026-09-25** `a4fccd4bf54d` — 1 info
  - api tag `guardrails` added
- **2026-09-21** `6246f8d427b7` — 1 info
  - api tag `guardrails` removed
- **2026-09-19** `c357baf422ab` — 1 info
  - api tag `guardrails` added

[Full history](https://skmtc.dev/flock/apis/litellm-api/changes/apply_guardrail/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/b694deb1e459?raw)
