API Documentation
Everything you need to integrate AI Trust Stack into your application.
Quick Start
Get started in 3 steps: get an API key, make your first request, check the results.
1. Get a free API key
Visit /signup to get 10,000 free credits, or use the API:
curl -X POST https://api.ai-trust-stack.com/v1/api-keys \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "credits": 10000}'2. Analyze content
curl -X POST https://api.ai-trust-stack.com/v1/analyze \
-H "Authorization: Bearer ats_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"content": "Your text content to analyze...",
"checkQuality": true,
"checkCompliance": true
}'3. Use the results
The response includes quality scores, compliance violations, and metadata about credits used.
Authentication
All protected endpoints require an API key. Pass it in the Authorization header:
Authorization: Bearer ats_YOUR_KEY_HERE
# Or use X-API-Key header:
X-API-Key: ats_YOUR_KEY_HERENote: The checkout and API key creation endpoints are public (no auth required). All /v1/analyze and service endpoints require authentication.
POST /v1/analyze
The unified analysis endpoint. Runs quality scoring, compliance checking, model routing, and fact verification in a single call.
Request Body
| Field | Type | Default | Description |
|---|---|---|---|
| content | string | required | Text to analyze (1-100,000 chars) |
| contentType | string | general | blog_post, marketing_copy, technical_docs, email, social_media, academic, creative, general |
| checkQuality | boolean | true | Run quality scoring |
| checkCompliance | boolean | true | Run compliance scanning |
| suggestModel | boolean | false | Get model recommendation |
| verifyFacts | boolean | false | Run fact verification |
| qualityStrategy | string | quick | quick, deep, or premium |
| regulations | string[] | ["pii"] | pii, gdpr, hipaa, ccpa, sox |
Examples
curl
curl -X POST https://api.ai-trust-stack.com/v1/analyze \
-H "Authorization: Bearer ats_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"content": "The new AI model achieves 95% accuracy on benchmark tests.",
"contentType": "blog_post",
"checkQuality": true,
"checkCompliance": true,
"regulations": ["pii", "gdpr"]
}'Python
import requests
API_KEY = "ats_YOUR_KEY_HERE"
BASE_URL = "https://api.ai-trust-stack.com"
response = requests.post(
f"{BASE_URL}/v1/analyze",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"content": "Your content to analyze...",
"checkQuality": True,
"checkCompliance": True,
"regulations": ["pii", "hipaa"],
},
)
data = response.json()
print(f"Quality: {data['data']['qualityScore']}")
print(f"Compliance: {data['data']['complianceScan']}")
print(f"Credits used: {data['data']['metadata']['creditsUsed']}")Node.js
const API_KEY = "ats_YOUR_KEY_HERE";
const BASE_URL = "https://api.ai-trust-stack.com";
const response = await fetch(`${BASE_URL}/v1/analyze`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
content: "Your content to analyze...",
checkQuality: true,
checkCompliance: true,
regulations: ["pii", "hipaa"],
}),
});
const { data } = await response.json();
console.log("Quality:", data.qualityScore);
console.log("Compliance:", data.complianceScan);
console.log("Credits used:", data.metadata.creditsUsed);Response
{
"success": true,
"data": {
"analysisId": "req_abc123",
"qualityScore": {
"overall": 8.2,
"dimensions": {
"accuracy": 8.5,
"clarity": 7.9,
"completeness": 8.0,
"consistency": 8.4,
"relevance": 8.8,
"tone": 7.6
},
"suggestions": ["Consider adding citations..."]
},
"complianceScan": {
"isSafe": true,
"violations": [],
"riskScore": 0.1,
"regulationsChecked": ["pii", "gdpr"]
},
"metadata": {
"requestId": "req_abc123",
"timestamp": "2026-02-11T12:00:00Z",
"processingTimeMs": 1250,
"creditsUsed": 4,
"servicesInvoked": ["quality-score", "ai-shield"],
"breakdown": [
{ "service": "quality-score", "creditsUsed": 2, "processingTimeMs": 800 },
{ "service": "ai-shield", "creditsUsed": 2, "processingTimeMs": 450 }
]
}
}
}POST /v1/checkout/session
Create a Stripe checkout session to purchase API credits. No authentication required.
Pricing: $50 per 10,000 credits ($0.005/credit). Minimum: 1,000 credits ($5).
Request
curl -X POST https://api.ai-trust-stack.com/v1/checkout/session \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"credits": 10000,
"successUrl": "https://yourapp.com/success",
"cancelUrl": "https://yourapp.com/cancel"
}'Response
{
"success": true,
"data": {
"sessionId": "cs_test_abc123",
"url": "https://checkout.stripe.com/pay/cs_test_abc123",
"expiresAt": "2026-02-11T13:00:00Z"
}
}Redirect the user to the url to complete payment. After payment, generate an API key via POST /v1/api-keys.
API Key Endpoints
POST /v1/api-keys
Create a new API key. No authentication required. The raw key is returned once and never stored.
curl -X POST https://api.ai-trust-stack.com/v1/api-keys \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"credits": 10000
}'
# Response:
{
"success": true,
"data": {
"apiKey": "ats_a1b2c3d4...",
"keyId": "uuid-here",
"tier": "free",
"credits": 10000,
"rateLimit": 60,
"message": "IMPORTANT: Save this key now. It will not be shown again."
}
}GET /v1/api-keys?email=you@example.com
List your API keys (masked). Shows credits remaining, tier, and usage stats.
curl "https://api.ai-trust-stack.com/v1/api-keys?email=you@example.com"
# Response:
{
"success": true,
"data": {
"keys": [
{
"id": "uuid-here",
"tier": "free",
"credits": 9500,
"rateLimit": 60,
"createdAt": "2026-02-11T12:00:00Z",
"isActive": true
}
],
"total": 1
}
}Individual Service Endpoints
You can also call individual services directly instead of using the unified gateway:
| Endpoint | Service | Cost |
|---|---|---|
| POST /v1/quality/score | Quality Score | $0.005/call |
| POST /v1/shield/scan | AI Shield | $0.003/call |
| POST /v1/router/recommend | Model Router | $0.001/call |
| POST /v1/verify/claims | Claim Verify | $0.01/call |
Error Handling
All errors follow a consistent format:
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Content is required"
}
}| HTTP Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request parameters |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 402 | INSUFFICIENT_CREDITS | Not enough credits remaining |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests per minute |
| 500 | INTERNAL_ERROR | Server error |
Rate Limits
Rate limits are determined by your API key tier:
| Tier | Credits | Rate Limit |
|---|---|---|
| Free | < 100K | 60 req/min |
| Pro | 100K+ | 300 req/min |
| Enterprise | 1M+ | 1,000 req/min |
Rate limit headers are included in every response:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1707656460