Guardrailz
HomeHubBlogsPricingDocs

Introduction

  • Overview
  • Architecture
  • Core Concepts

Getting Started

  • Installation
  • Quickstart
  • Playground

API

  • Validate API
  • Profiles API
  • Analytics API
  • Error Handling

SDK

  • Overview
  • Client
  • Guardrails
  • Examples

Guardrails

  • Overview
  • Input Guardrails
  • Output Guardrails
  • Tool Guardrails
  • Custom Guardrails

Profiles

  • Overview
  • Built-in Profiles
  • Custom Profiles
  • Profile Compilation

Analytics

  • Overview
  • Events
  • Queries
  • Dashboards

Deployment

  • Environment
  • Security
  • Scaling
  1. Docs
  2. /api
  3. /validate

Validate API

The Validate API is the core runtime endpoint used to execute guardrails against user input or model output.

It evaluates content using a selected profile, applies configured guardrails, and returns structured enforcement results.

Endpoint

 
POST /api/validate
 

Request Body

{
  "text": "Hello, this is a test input.",
  "profileName": "default",
  "validationType": "input"
}

Fields

| Field            | Type                   | Required  |  Description                      |
| -                | -                      | --        | --                                |
| `text`           | string                 | True        | Input or output text to validate |
| `profileName`    | string                 | True        | Guardrail profile to apply       |
| `validationType` | `"input"` | `"output"` | True        | Validation phase                 |

Response

{
  "passed": false,
  "profile": "default",
  "results": [
    {
      "guardrail": "SecretsInInput",
      "passed": false,
      "severity": "critical",
      "message": "Potential secret detected"
    }
  ],
  "executionTimeMs": 42
}

Behavior

  • Guardrails execute in order
  • Execution stops early for blocking failures
  • All executions are tracked for analytics

Usage via SDK

import { GuardrailsClient } from '@guardrailz/sdk';
 
const client = new GuardrailsClient({
  apiKey: process.env.GUARDRAILS_API_KEY!,
});
 
await client.validate({
  text: 'My input',
  profileName: 'default',
});

Notes

  • Profiles define which guardrails run
  • Results include granular per-guardrail outcomes
  • Designed for low latency production use