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. /errors

Errors

Guardrails APIs return structured, predictable errors to simplify handling and debugging.

Error Format

{
  "error": "InvalidProfile",
  "message": "Profile 'unknown-profile' does not exist"
}

Common Errors

Unauthorized

{
  "error": "Unauthorized",
  "message": "Authentication required"
}

Invalid Profile

{
  "error": "InvalidProfile",
  "message": "Profile not found"
}

Validation Failed

{
  "error": "ValidationFailed",
  "message": "One or more guardrails failed"
}

HTTP Status Codes

| Code | Meaning | | - | | | 400 | Invalid request | | 401 | Unauthorized | | 403 | Forbidden | | 404 | Resource not found | | 429 | Rate limited | | 500 | Internal error |

SDK Error Handling

The SDK throws typed errors:

try {
  await client.validate(...)
} catch (err) {
  console.error(err.message);
}

Best Practices

  • Log error code and message
  • Retry only idempotent requests
  • Treat 429 as backpressure
 
 
 
## What you now have
 
✔ Clean, professional API docs
✔ SDK-aligned examples
✔ Scalable content structure
✔ Zero React logic in MDX
✔ Ready for versioning & search