Skip to main content
POST
/
v1
/
validate-text
Validate Text
curl --request POST \
  --url https://gateway.oximy.com/v1/validate-text \
  --header 'x-oximy-api-key: <api-key>'
Standalone Validation Endpoint: This endpoint validates text against guardrails without proxying to any AI provider. Use this when you want Oximy’s protection capabilities independently from the Gateway proxy service.

Overview

The Validate Text endpoint provides standalone validation of text against your project’s guardrails. Unlike Gateway’s proxy endpoints (/v1/chat/completions, /v1/embeddings, etc.), this endpoint does not send requests to any AI provider.

When to Use This Endpoint

Use /v1/validate-text when you need guardrail protection without using Gateway as a proxy:
  • Pre-validation: Check text before sending to AI models (using any provider directly)
  • Output validation: Validate AI-generated responses after receiving them
  • Batch processing: Validate large amounts of text for compliance
  • Custom workflows: Build your own validation pipelines
  • Testing: Test guardrail configurations before deployment

When to Use Proxy Endpoints Instead

Use Gateway’s proxy endpoints (/v1/chat/completions, etc.) when you want:
  • Automatic protection: Guardrails applied automatically to AI requests
  • Drop-in replacement: Works with existing OpenAI SDK code
  • Full integration: Complete request/response protection in one step

Proxy vs Standalone Comparison

FeatureProxy EndpointsValidate Text Endpoint
Proxies to AIYesNo
Applies GuardrailsYesYes
Use CaseAI requests with protectionIndependent validation
Examples/v1/chat/completions/v1/validate-text
SetupOpenAI SDK compatibleDirect HTTP requests

Authentication

This endpoint uses API key authentication via the x-oximy-api-key header:
x-oximy-api-key: oxi-live-YOUR_API_KEY
Get your API key from the Oximy Dashboard.

Example Request

{
  "projectId": "my-project-slug",
  "text": "My email is [email protected] and my API key is sk-abc123def456"
}

Response

The response includes:
  • originalText: The original text you submitted
  • redactedText: The text with sensitive data replaced by placeholders
  • enforcementLevel: The highest enforcement level detected (WARN or BLOCK)
  • hasViolations: Boolean indicating if any violations were found
  • violatedGuardrails: Array of guardrails that detected violations

Response Headers

HeaderDescription
x-oximy-cache-hitWhether the response was served from cache (boolean)
x-oximy-cache-timestampCache timestamp (ISO 8601)

Example Response (No Violations)

{
  "originalText": "Hello, how can I help you?",
  "redactedText": "Hello, how can I help you?",
  "enforcementLevel": "WARN",
  "hasViolations": false,
  "violatedGuardrails": []
}

Example Response (With Violations)

{
  "originalText": "My email is [email protected]",
  "redactedText": "My email is [EMAIL_REDACTED]",
  "enforcementLevel": "WARN",
  "hasViolations": true,
  "violatedGuardrails": [
    {
      "guardrailSlug": "data-leakage-prevention",
      "guardrailName": "Data Leakage Prevention",
      "category": "PII",
      "enforcementLevel": "WARN",
      "matchedText": "[email protected]",
      "placeholder": "[EMAIL_REDACTED]",
      "location": "0:24"
    }
  ]
}