---
title: "Post Check V2 Endpoint"
method: POST
path: "/v2/check"
tags: ["Guardrails"]
---

# Post Check V2 Endpoint

`POST /v2/check`

## Request

- Base URL: `https://api.pharia.example.com`
- URL: `https://api.pharia.example.com/v2/check`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/aleph-alpha/apis/stateful-responses/docs/v2/check/post.ts> (a function with typed inputs; its response is checked against the schema)

Check content against guardrails, reporting ``streaming_allowed`` too.

## Request body

- CheckRequest: Inbound request to check content against guardrails.
  - `application_id` string, nullable
  - `check_type` 'input' | 'output', required: A point in the request lifecycle a guardrail policy can check. The single registry every ``check_types`` key and ``CheckRequest.check_type`` must belong to. Adding a checkpoint (``tool_input``, ``tool_output``, ...) means adding one member here plus its effect-table row, not new branching at each call site.
  - `input` string, required
  - `context` CheckContext: Framing information for a check, carried alongside the content. ``checkpoint`` is the checkpoint being evaluated. ``user_prompt`` is the real user turn that preceded the content under check, when the caller has one. For an ``output`` check it drives the Llama Guard agent-response framing: with a ``user_prompt``, the conversation holds a user turn then an agent turn; without one, the agent turn alone.
    - `checkpoint` 'input' | 'output', required: A point in the request lifecycle a guardrail policy can check. The single registry every ``check_types`` key and ``CheckRequest.check_type`` must belong to. Adding a checkpoint (``tool_input``, ``tool_output``, ...) means adding one member here plus its effect-table row, not new branching at each call site.
    - `user_prompt` string, nullable
  - `images` GuardrailImage[]
    - `search_store_id` string, required
    - `file_id` string, required
  - `unreferenced_image_count` integer
  - `if_unconfigured` 'error' | 'allow'

## Response `200`

Successful Response

- CheckResponseV2: Result of a guardrail check, with ``streaming_allowed``.
  - `safe` boolean, required
  - `violations` Violation[], required
    - `category` string, required
    - `provider` string, required
    - `stage` string, required
    - `step` integer, required
    - `reason` string, nullable
  - `action` 'allow' | 'label' | 'block': What happens to a message a guardrail flagged. ``ALLOW`` passes it to the model untouched. ``LABEL`` passes it together with a notice naming the flagged categories, so the model can decline or answer only the harmless part. ``BLOCK`` stops the request before it reaches the model.
  - `evaluated` boolean
  - `configured_checkpoints` Checkpoint[], nullable
  - `streaming_allowed` boolean, nullable

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `413`: Content Too Large
- `422`: Validation errors are returned as 400, not 422. This entry exists because FastAPI generates it automatically.
- `425`: Too Early
- `500`: Internal Server Error
- `501`: Not Implemented
- `502`: Bad Gateway

---

[API](https://skmtc.dev/aleph-alpha/apis/stateful-responses.md) - [All operations](https://skmtc.dev/aleph-alpha/apis/stateful-responses/llms.txt) - [OpenAPI document](https://skmtc.dev/aleph-alpha/apis/stateful-responses/revisions/2747297acb54?raw)
