Docs/Quick Start

Quick Start

Make your first authenticated API call in under 5 minutes. We'll cover getting your API key, sending your first request, and interpreting the response.

1

Create an account and get your API key

Sign in at guardrail.ai/login using your GitHub or Google account. Once inside your dashboard, navigate to API Keys and click Generate New Key.

⚠️

Your full key is shown only once at generation. Copy it to a secure secrets manager immediately. We store only a SHA-256 hash.

2

Send your first request

Use any HTTP client. The base URL is:

POST https://api.guardrail.ai/v1/guardrail/check
bash (cURL)
curl -X POST https://api.guardrail.ai/v1/guardrail/check \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "my-customer-support-agent",
    "proposed_text": "Your credit card ending in 4242 has been refunded $200."
  }'
python
import requests

GUARDRAIL_URL = "https://api.guardrail.ai/v1/guardrail/check"
API_KEY = "sk_your_api_key_here"

response = requests.post(
    GUARDRAIL_URL,
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "agent_id": "my-customer-support-agent",
        "proposed_text": "Your credit card ending in 4242 has been refunded $200."
    }
)

result = response.json()
print(result)
javascript (node.js)
const response = await fetch('https://api.guardrail.ai/v1/guardrail/check', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_your_api_key_here',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    agent_id: 'my-customer-support-agent',
    proposed_text: 'Your credit card ending in 4242 has been refunded $200.',
  }),
});

const result = await response.json();
console.log(result);
3

Understand the response

Every successful call returns a structured JSON object.

json (response)
{
  "risk_score": 85,
  "status": "flagged",
  "flags": [
    "PII detected: Credit card number suffix (4242) identified",
    "Financial commitment: Unauthorized refund of $200 mentioned"
  ],
  "redacted_text": "Your credit card ending in **** has been refunded $***."
}
risk_score

Integer 0–100. 0 = safe, 100 = maximum risk. We recommend rejecting anything above 60.

status

`approved`, `flagged`, or `rejected`. Map this to your agent's allow/block logic.

flags

Array of human-readable strings explaining every rule violation found.

redacted_text

A sanitized copy of the input text with sensitive data replaced by asterisks. Safe to log.

You're live!

You've successfully integrated Guardrail.ai. Each call costs $0.01 and is deducted from your credits balance automatically.