API Documentation
Integrate AI governance and integrity monitoring into your applications with our comprehensive API.
The AI Integrity Platform API provides programmatic access to our Guardian Agent anti-hallucination system, integrity monitoring, and governance tools.
https://your-domain.replit.app/api
import requests
# Initialize session
session = requests.Session()
base_url = "https://your-domain.replit.app/api"
# Login required for session-based authentication
login_response = session.post("https://your-domain.replit.app/login", data={
"username": "your_username",
"password": "your_password"
})
# Analyze text for hallucinations
response = session.post(
f"{base_url}/analyze-hallucination",
json={
"ai_response": "Your AI-generated text to analyze",
"context": "Optional context for analysis",
"domain": "general"
}
)
result = response.json()
print(f"Hallucination probability: {result['hallucination_probability']}")
All API requests require session-based authentication. You must login to the platform first to establish a session cookie.
curl -X POST https://your-domain.replit.app/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=your_username&password=your_password" \
-c cookies.txt
curl -X GET https://your-domain.replit.app/api/systems \
-H "Content-Type: application/json" \
-b cookies.txt
Sessions are maintained server-side. Ensure your HTTP client supports cookies for persistent authentication.
Access our advanced anti-hallucination detection and correction system.
Analyze AI responses for potential hallucinations using our Guardian Agent system.
{
"ai_response": "AI-generated text to analyze for hallucinations",
"context": "Optional context for analysis",
"domain": "general"
}
{
"is_hallucination": false,
"confidence": 0.85,
"hallucination_probability": 0.15,
"processing_time_ms": 245,
"method_used": "guardian_agent",
"detections": [
{
"type": "factual_fabrication",
"confidence": 0.75,
"evidence": "Statistical claim lacks supporting data",
"suggested_correction": "Revised text with verification"
}
],
"recommendations": [
"Verify statistical claims with authoritative sources",
"Add citations for factual statements"
]
}
Analyze multiple conversation exchanges for hallucination patterns.
{
"conversations": [
{
"user_message": "User question",
"ai_response": "AI response to analyze",
"context": "Optional context"
},
{
"user_message": "Another user question",
"ai_response": "Another AI response to analyze",
"context": "Optional context"
}
],
"domain": "general"
}
Manage AI systems, monitor performance, and track activity.
Retrieve all configured AI systems.
{
"systems": [
{
"id": "sys_123",
"name": "Production GPT-4",
"type": "openai_gpt",
"status": "active",
"created_at": "2025-01-01T10:00:00Z"
}
]
}
Add a new AI system for monitoring.
{
"name": "My AI System",
"description": "Description of the AI system",
"system_type": "openai_gpt",
"api_endpoint": "https://api.openai.com/v1/chat/completions",
"model_name": "gpt-4",
"config": {
"temperature": 0.7,
"max_tokens": 1000
}
}
Get real-time performance metrics for AI systems.
{
"interaction_id": "unique_interaction_id",
"ai_model": "gpt-4o",
"prompt": "User prompt to AI",
"response": "AI generated response",
"metadata": {
"user_id": "user123",
"session_id": "session456",
"timestamp": "2025-01-01T12:00:00Z"
}
}
{
"compliance_score": 0.92,
"integrity_violations": [],
"recommendations": [
"Monitor for potential bias in financial advice"
],
"audit_record_id": "audit_789"
}
Connect and manage AI platforms through our unified interface.
List connected AI platforms
Connect new AI platform
Check platform health status
Update platform configuration
API usage is subject to rate limits based on your subscription tier.
100
requests per hour
1,000
requests per hour
10,000
requests per hour
X-RateLimit-Limit
: Request limit per time window
X-RateLimit-Remaining
: Requests remaining in current window
X-RateLimit-Reset
: Time when the rate limit resets
The API uses standard HTTP status codes and provides detailed error information.
{
"error": {
"code": "INVALID_REQUEST",
"message": "The request is missing required parameters",
"details": {
"missing_fields": ["text", "domain"]
},
"request_id": "req_123456789"
}
}
Access your API keys and start integrating AI governance into your applications.
Get API Keys