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. /getting started
  3. /installation

Installation

This guide walks you through installing Guardrails in your application using either the REST API or the official SDK.

Guardrails is designed to work with any language, framework, or LLM provider.

Installation options

You can integrate Guardrails in three ways:

  1. SDK (recommended) – Best developer experience
  2. REST API – Language-agnostic
  3. Self-hosted engine – Advanced / enterprise use cases

Install via npm (SDK)

npm install @guardrailz/sdk

Or with Yarn:

yarn add @guardrailz/sdk

Install via CDN (browser usage)

<script src="https://your-domain.com/sdk/guardrails-sdk.js"></script>

This exposes a global Guardrails object.

Environment variables

Create an API key in the dashboard and set it as an environment variable.

GUARDRAILS_API_KEY=gr_live_xxxxxxxxx
GUARDRAILS_BASE_URL=https://api.guardrails.dev

Never expose your API key in client-side code.

Verify installation

You should be able to run a basic validation request after installation.

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

If this runs without errors, Guardrails is installed correctly.

Next steps

  • Learn how to run your first guardrail → Quickstart
  • Explore profiles and policies → Core Concepts