Skip to main content

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
curl -X POST https://api.aitruststack.com/v1/api-keys \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "credits": 10000}'

2. Analyze content

curl
curl -X POST https://api.aitruststack.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:

http
Authorization: Bearer ats_YOUR_KEY_HERE

# Or use X-API-Key header:
X-API-Key: ats_YOUR_KEY_HERE

Note: 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

POST /v1/analyze request body fields
FieldTypeDefaultDescription
contentstringrequiredText to analyze (1-100,000 chars)
contentTypestringgeneralblog_post, marketing_copy, technical_docs, email, social_media, academic, creative, general
checkQualitybooleantrueRun quality scoring
checkCompliancebooleantrueRun compliance scanning
suggestModelbooleanfalseGet model recommendation
verifyFactsbooleanfalseRun fact verification
qualityStrategystringquickquick, deep, or premium
regulationsstring[]["pii"]pii, gdpr, hipaa, ccpa, sox

Examples

curl

bash
curl -X POST https://api.aitruststack.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

python
import requests

API_KEY = "ats_YOUR_KEY_HERE"
BASE_URL = "https://api.aitruststack.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

javascript
const API_KEY = "ats_YOUR_KEY_HERE";
const BASE_URL = "https://api.aitruststack.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

json
{
  "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

bash
curl -X POST https://api.aitruststack.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

json
{
  "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.

bash
curl -X POST https://api.aitruststack.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.

bash
curl "https://api.aitruststack.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:

Individual service endpoints and pricing
EndpointServiceCost
POST /v1/quality/scoreQuality Score$0.005/call
POST /v1/shield/scanAI Shield$0.003/call
POST /v1/router/recommendModel Router$0.001/call
POST /v1/verify/claimsClaim Verify$0.01/call

Quality Score API

Multi-dimensional evaluation of AI-generated content. Scores clarity, depth, engagement, practical value, naturalness, and overall quality. Also detects AI-generated patterns.

POST /v1/quality/score

bash
curl -X POST https://api.aitruststack.com/v1/quality/score \
  -H "Authorization: Bearer ats_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Your AI-generated content here",
    "contentType": "blog_post",
    "strategy": "deep"
  }'

Response

json
{
  "success": true,
  "data": {
    "overall": 8.2,
    "dimensions": {
      "clarity": 8.5,
      "depth": 7.9,
      "engagement": 8.0,
      "practicalValue": 8.4,
      "naturalness": 8.8,
      "aiDetection": 0.15
    },
    "flags": { "likelyAiGenerated": false },
    "suggestions": ["Add specific examples to improve depth."],
    "metadata": { "creditsUsed": 2, "processingTimeMs": 1100 }
  }
}

AI Shield API

Detect PII, PHI, and compliance violations before they reach production. Supports GDPR, HIPAA, CCPA, SOX, and PII scanning in a single call.

POST /v1/shield/scan

bash
curl -X POST https://api.aitruststack.com/v1/shield/scan \
  -H "Authorization: Bearer ats_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Content to scan for PII/PHI",
    "regulations": ["gdpr", "hipaa", "ccpa"]
  }'

Response

json
{
  "success": true,
  "data": {
    "isSafe": false,
    "riskScore": 0.85,
    "violations": [
      {
        "type": "email",
        "regulation": "pii",
        "value": "john@example.com",
        "position": { "start": 42, "end": 58 }
      }
    ],
    "regulationsChecked": ["gdpr", "hipaa", "ccpa"],
    "metadata": { "creditsUsed": 2, "processingTimeMs": 450 }
  }
}

Model Router API

Intelligent routing to the best AI model for each request. Optimize for cost, speed, or quality. Includes automatic fallback chains and a learning loop that improves routing over time.

POST /v1/router/recommend

bash
curl -X POST https://api.aitruststack.com/v1/router/recommend \
  -H "Authorization: Bearer ats_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "task": "summarize",
    "complexity": "medium",
    "priority": "cost"
  }'

Response

json
{
  "success": true,
  "data": {
    "recommendedModel": "claude-haiku-3",
    "provider": "anthropic",
    "confidence": 0.87,
    "reasoning": "Low complexity summarization — fast, cheap model optimal",
    "fallbackChain": ["gpt-3.5-turbo", "gemini-flash"],
    "estimatedCost": 0.0003,
    "metadata": { "creditsUsed": 1, "processingTimeMs": 120 }
  }
}

Gateway API

The unified entry point for the entire AI Trust Stack. Coordinates quality scoring, compliance detection, model routing, and fact verification in a single API call with one API key.

See POST /v1/analyze for the full request reference, or use the individual service endpoints for targeted checks.

Available Endpoints

Gateway API available endpoints
EndpointDescription
POST /v1/analyzeFull analysis — quality, compliance, routing in one call
POST /v1/quality/scoreQuality scoring proxy
POST /v1/shield/scanCompliance scanning proxy
POST /v1/router/recommendModel routing proxy
GET /healthHealth check for all services

Error Handling

All errors follow a consistent format:

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Content is required"
  }
}
HTTP error status codes and descriptions
HTTP StatusCodeDescription
400VALIDATION_ERRORInvalid request parameters
401UNAUTHORIZEDMissing or invalid API key
402INSUFFICIENT_CREDITSNot enough credits remaining
429RATE_LIMIT_EXCEEDEDToo many requests per minute
500INTERNAL_ERRORServer error

Rate Limits

Rate limits are determined by your API key tier:

Rate limits by plan tier
TierCreditsRate Limit
Free< 100K60 req/min
Pro100K+300 req/min
Enterprise1M+1,000 req/min

Rate limit headers are included in every response:

http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1707656460

© 2026 AI Trust Stack. All rights reserved.