---
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-19** `c357baf422ab` — 1 info
  - api tag `guardrails` added
- **2026-09-18** `082b5fabd909` — 7 info
  - api tag `guardrails` removed
  - added the new optional request property `metadata`
  - added the new `UK_PASSPORT` enum value to the request property `entities/anyOf[subschema #1]/items/`
  - added the new `UK_POSTCODE` enum value to the request property `entities/anyOf[subschema #1]/items/`
  - …3 more
- **2026-09-17** `e2f308355e2d` — 1 info
  - api tag `guardrails` added
- **2026-09-01** `89805a9f84ad` — 1 info
  - api tag `guardrails` removed
- **2026-09-01** `5c00a227eebf` — 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/3b2b241e4b0b?raw)
