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.ai-trust-stack.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.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:

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

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

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

javascript
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

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

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

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

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

Error Handling

All errors follow a consistent format:

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Content is required"
  }
}
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:

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