API Documentation

APEX-CORE REST API for physics violation detection

Contents

Authentication

All API requests require an API key. Get a free key at /pricing.

Include your API key in requests using one of these methods:

Option 1: X-API-Key Header (Recommended)

curl -H "X-API-Key: apex_your_key_here" https://apex-core-production.up.railway.app/api/health

Option 2: Authorization Bearer Header

curl -H "Authorization: Bearer apex_your_key_here" https://apex-core-production.up.railway.app/api/health

Option 3: Query Parameter

curl "https://apex-core-production.up.railway.app/api/health?api_key=apex_your_key_here"

Rate Limits

Tier Daily Limit Monthly Limit Price
Free 5 25 $0
Pro 100 3,000 $49/mo
Enterprise 1,000 50,000 Contact us

When you exceed limits, the API returns 429 Too Many Requests.

Endpoints

POST /analyze-text

Analyze text for physics violations. This is the main endpoint.

Request Body

FieldTypeDescription
text requiredstringThe claim or patent text to analyze
titlestringOptional title for the analysis

Response

{
  "patent_id": "CUSTOM-TEXT",
  "title": "Custom Analysis",
  "verdict": "violation",
  "confidence": 0.95,
  "energy_source": "No legitimate energy source identified",
  "physics_issues": [
    "Violates First Law of Thermodynamics",
    "No identifiable input energy"
  ],
  "explanation": "The claim describes perpetual motion...",
  "violation_patterns": ["PATTERN B - THERMODYNAMICALLY IMPOSSIBLE"]
}
POST /analyze

Analyze a patent by its ID (fetches from Google Patents).

FieldTypeDescription
patent_id requiredstringPatent number (e.g., US20060163971A1)
POST /api/priority

Quick priority scoring (instant, pattern-based). Use this to triage before full analysis.

FieldTypeDescription
text requiredstringText to score
POST /api/register

Register for a free API key. No authentication required.

FieldTypeDescription
emailstringOptional email for account recovery

Response

{
  "success": true,
  "api_key": "apex_abc123...",
  "tier": "free",
  "limits": {"daily": 5, "monthly": 25},
  "message": "Save your API key - it won't be shown again!"
}
GET /api/key-info

Get info about your API key and remaining usage.

Response

{
  "tier": "free",
  "email": "user@example.com",
  "limits": {"daily": 5, "monthly": 25},
  "usage": {"remaining_daily": 4, "remaining_monthly": 24}
}
GET /api/health

Check API status. No authentication required.

Code Examples

cURL

# Analyze text
curl -X POST https://apex-core-production.up.railway.app/analyze-text \
  -H "Content-Type: application/json" \
  -H "X-API-Key: apex_your_key_here" \
  -d '{"text": "Perpetual motion machine that generates free energy"}'

Python

import requests

API_KEY = "apex_your_key_here"
BASE_URL = "https://apex-core-production.up.railway.app"

def analyze_claim(text):
    response = requests.post(
        f"{BASE_URL}/analyze-text",
        headers={
            "Content-Type": "application/json",
            "X-API-Key": API_KEY
        },
        json={"text": text}
    )
    return response.json()

result = analyze_claim("Perpetual motion machine")
print(f"Verdict: {result['verdict']}")
print(f"Confidence: {result['confidence']}")

JavaScript (fetch)

const API_KEY = 'apex_your_key_here';
const BASE_URL = 'https://apex-core-production.up.railway.app';

async function analyzeClaim(text) {
  const response = await fetch(`${BASE_URL}/analyze-text`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY
    },
    body: JSON.stringify({ text })
  });
  return response.json();
}

// Usage
analyzeClaim('Perpetual motion machine')
  .then(result => console.log(result.verdict));

Error Handling

StatusMeaningResponse
200SuccessAnalysis result
400Bad RequestMissing or invalid parameters
401UnauthorizedMissing or invalid API key
429Too Many RequestsRate limit exceeded
500Server ErrorInternal error

Error Response Format

{
  "error": "API key required",
  "message": "Include your API key via X-API-Key header...",
  "get_key": "/pricing"
}

Questions? Email Tom@apex-core.org

Back to Home