/v1/decisions, the typed-judgment endpoint. This lets you screen the content a decision is made about before it reaches the model, the same way you would for a chat or embedding request. Guardrails work with both request shapes and every supported provider.
Why Use Guardrails for Decisions?
A decisions request has three parts:model, questions, and the content to judge. The content is state in the Jev shape and input in the OpenAI shape. Only that content is caller-supplied — model and questions (including any criteria, choices, or levels) are your own application’s instructions. Guardrails scan the content alone, so they check what a user or upstream system fed into the judgment, never your prompt design.
This matters because the content often carries the same kind of untrusted text you’d otherwise send to a chat model — support tickets, form submissions, extracted document text — before it’s judged, scored, or classified. Guardrails let you catch PII, prompt injection, or policy violations in that content before the judgment call is made.
How It Works
Guardrails for decisions run only at the before-request stage, on the content to judge only:- Your application sends the content to judge,
model, andquestionsto/v1/decisions. - Portkey’s before-request guardrails scan the content —
statein the Jev shape, or the text ininputin the OpenAI shape. They never scanmodel,questions, or nestedcriteria,choices, orlevels. - If all checks pass, the request (with the content possibly redacted by a mutator) is forwarded to the provider.
- If a check fails, the configured guardrail action applies: log only, soft-deny with a
200, or hard-deny with a446.
There are no after-request (output) guardrails on
/v1/decisions. A successful answer is a typed judgment — a choice, a score, or a probability — with no free text to scan, so only input_guardrails apply. This mirrors Guardrails for Embeddings.Redacting the Content
Mutator guardrails (for example, PII redaction) can rewrite the content before it’s forwarded. Redaction is written back into the shape the request used. Jev shape (state)
- If
statewas a plain string, the redacted text replaces it directly. - If
statewas a JSON object or array, the redacted text is parsed back into JSON before being written back. - If a mutator’s output is no longer valid JSON for an object/array
state, Portkey keeps the originalstateunchanged rather than forwarding corrupted content.
input)
- If
inputwas a string, the redacted text replaces it. - If
inputwas a list of messages, each message’s text is redacted in place. Messageroleand non-text parts such asinput_imageare left unchanged. Only message text andinput_textparts are scanned.
Response When a Guardrail Fails
A hard deny (deny: true, no soft-deny) returns 446 with the standard guardrail error shape:
deny: true, softDeny200: true) returns 200 with empty answers instead of an OpenAI-style error envelope, keeping the response shape consistent with a normal decisions response. answers is {} for a Jev-shaped request and [] for an OpenAI-shaped request:
Setting Up Guardrails for Decisions
1. Create a Guardrail
- Navigate to the
Guardrailspage and clickCreate. - Select a check that supports
beforeRequestHook(for example, PII Detection, Regex Match, Moderate Content). - Configure the check parameters and set the action for failed checks (log, soft-deny, or hard-deny).
- Save the guardrail to get its ID.
Only guardrails that support
beforeRequestHook run on /v1/decisions. Guardrails scoped to afterRequestHook only are skipped for this endpoint.2. Add the Guardrail to Your Config
3. Use the Config with a Decisions Request
cURL
Learn More
Guardrails Overview
Create guardrails, configure actions, attach to requests
Supported Endpoints & Capabilities
Where guardrails run across the gateway
Decisions API
Request shapes, supported providers, and question types
TypeSafe (Jev)
Provider setup and quick start for /v1/decisions
List of Guardrail Checks
All built-in and partner checks
Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us

