---
title: "Validate Policy"
method: POST
path: "/policy/validate"
tags: ["policy management"]
---

# Validate Policy

`POST /policy/validate`

Validate a policy configuration before applying it.

Checks:
- All referenced guardrails exist in the guardrail registry
- All non-wildcard team aliases exist in the database
- All non-wildcard key aliases exist in the database
- Inheritance chains are valid (no cycles, parents exist)
- Scope patterns are syntactically valid

Returns:
- valid: True if the policy configuration is valid (no blocking errors)
- errors: List of blocking validation errors
- warnings: List of non-blocking validation warnings

Example request:
```json
{
    "policies": {
        "global-baseline": {
            "guardrails": {
                "add": ["pii_blocker", "phi_blocker"]
            },
            "scope": {
                "teams": ["*"],
                "keys": ["*"],
                "models": ["*"]
            }
        },
        "healthcare-compliance": {
            "inherit": "global-baseline",
            "guardrails": {
                "add": ["hipaa_audit"]
            },
            "scope": {
                "teams": ["healthcare-team"]
            }
        }
    }
}
```

## Request body

- PolicyValidateRequest — Request body for the /policy/validate endpoint.
  - `policies` object, required — Policy configuration to validate. Map of policy names to policy definitions.

## Response `200`

Successful Response

- PolicyValidationResponse — Response from policy validation. - `valid`: True if no blocking errors were found - `errors`: List of blocking errors (prevent policy from being applied) - `warnings`: List of non-blocking warnings (policy can still be applied)
  - `valid` boolean, required — True if the policy configuration is valid.
  - `errors` PolicyValidationError[] — List of blocking validation errors.
    - `policy_name` string, required — Name of the policy with the issue.
    - `error_type` 'invalid_guardrail' | 'invalid_team' | 'invalid_key' | 'invalid_model' | 'invalid_inheritance' | 'circular_inheritance' | 'invalid_scope' | 'invalid_syntax', required — Types of validation errors that can occur.
    - `message` string, required — Human-readable error message.
    - `field` string, nullable — Specific field that caused the error (e.g., 'guardrails.add', 'scope.teams').
    - `value` string, nullable — The invalid value that caused the error.
  - `warnings` PolicyValidationError[] — List of non-blocking validation warnings.
    - `policy_name` string, required — Name of the policy with the issue.
    - `error_type` 'invalid_guardrail' | 'invalid_team' | 'invalid_key' | 'invalid_model' | 'invalid_inheritance' | 'circular_inheritance' | 'invalid_scope' | 'invalid_syntax', required — Types of validation errors that can occur.
    - `message` string, required — Human-readable error message.
    - `field` string, nullable — Specific field that caused the error (e.g., 'guardrails.add', 'scope.teams').
    - `value` string, nullable — The invalid value that caused the error.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/sea-lion/apis/litellm-api.md) · [All operations](https://skmtc.net/sea-lion/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sea-lion/litellm-api/revisions/1e929292ddd5/schema)
