---
title: "Validate agent output"
method: POST
path: "/api/qualitygate/validate"
tags: ["QualityGate"]
---

# Validate agent output

`POST /api/qualitygate/validate`

## Request

- Base URL: `https://plith.ai`
- URL: `https://plith.ai/api/qualitygate/validate`
- Auth: none required

Validates agent output against one or more check types. Credit costs: directive_compliance=1, schema_validation=1, code_syntax=1, length=1, tone=8, factual_claims=8. Total = sum of requested checks. Returns HTTP 422 when verdict is 'fail'.

## Request body

- object
  - `output` string, required: The agent output text to validate.
  - `directives` object[]: Required for directive_compliance check.
    - `name` string: Display name for the directive.
    - `must_match` string: Regex: output MUST match.
    - `must_not_match` string: Regex: output MUST NOT match.
    - `must_contain` string[]: Keywords that must appear (case-insensitive).
    - `must_not_contain` string[]: Keywords that must NOT appear (case-insensitive).
    - `min_length` integer: Minimum output length in characters.
    - `max_length` integer: Maximum output length in characters.
  - `schema` object: JSON Schema object. Required for schema_validation check.
  - `language` string: Source language. Required for code_syntax check. Supported: json, python, javascript, typescript.
  - `check_types` string[]: Which checks to run. Auto-inferred from provided parameters if omitted.
  - `override` boolean: Force verdict to 'pass' regardless of score. Requires override_reason.
  - `override_reason` string: Required when override is true.

## Response `200`

Validation passed or warned

- object
  - `validation_id` string, uuid, nullable
  - `score` number
  - `verdict` 'pass' | 'warn'
  - `checks_run` string[]
  - `issues` object[]
    - `type` string
    - `severity` 'error' | 'warning' | 'info'
    - `detail` string
    - `path` string, nullable
    - `line` integer, nullable
  - `summary` object
    - `total` integer
    - `errors` integer
    - `warnings` integer
  - `override` object, nullable: Present only when override was applied.
    - `applied` boolean
    - `natural_verdict` string
    - `reason` string
  - `cross_product` object
  - `request_id` string
  - `credits_used` integer
  - `credits_remaining` integer
  - `fallback_behavior` string

## Other responses

- `400`: Missing output, no checks specified, or missing check prerequisites
- `401`: Invalid or missing API key
- `402`: Insufficient credits
- `422`: Validation failed (verdict is 'fail')

---

[API](https://skmtc.dev/plith/apis/plith-api.md) · [All operations](https://skmtc.dev/plith/apis/plith-api/llms.txt) · [OpenAPI document](https://skmtc.dev/plith/apis/plith-api/revisions/4a03164b0d75?raw)
