Developer Documentation
Everything you need to integrate SovrenAI into your product. Analyze text, write verified content, certify documents, and search — all via REST API.
Quickstart
Classify your first sentence in 30 seconds:
curl -X POST https://sovrenai.ai/api/analyze \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"text": "Water boils at 100 degrees Celsius at sea level."}'
Response:
{
"cus": [{
"source_text": "Water boils at 100 degrees Celsius at sea level.",
"tier": 2,
"tier_name": "Measured",
"confidence": 0.99,
"domain": "scientific",
"word_pills": [...]
}]
}
That's it. Every sentence gets a rating, a confidence score, and word-level definitions. No AI involved in the classification — it's deterministic.
Python
import requests
response = requests.post("https://sovrenai.ai/api/analyze", json={
"text": "Water boils at 100 degrees Celsius at sea level."
}, headers={"Authorization": "Bearer YOUR_API_KEY"})
for sentence in response.json()["cus"]:
print(f'{sentence["tier_name"]:20s} ({sentence["confidence"]:.0%}) | {sentence["source_text"]}')
JavaScript
const resp = await fetch("https://sovrenai.ai/api/analyze", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
body: JSON.stringify({ text: "Water boils at 100 degrees Celsius." })
});
const { cus } = await resp.json();
cus.forEach(s => console.log(`${s.tier_name} (${Math.round(s.confidence*100)}%) | ${s.source_text}`));
Authentication
All API requests require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Get your API key from Settings > API Key in the app. API access is available on the Pro and Business plans.
The /api/analyze and /api/classify endpoints are also available without authentication for public use (rate limited).
Rate Limits
Rate limits depend on your plan:
| Plan | Requests/min | AI Generations/mo | Certifications/mo | Price |
|---|---|---|---|---|
| Free Trial | 10 | 50 | 5 | $0 (15 days) |
| Starter | 30 | 800 | 50 | $10/mo |
| Pro | 60 | 1,600 | 200 | $20/mo |
| Business | 120 | 2,400 | Unlimited | $30/mo |
Classification endpoints are always free — /api/analyze and /api/classify don't count against your generation limit. Only AI-powered endpoints (chat, compile, ToBi) use generations.
When rate limited, you'll receive a 429 Too Many Requests response with a Retry-After header.
Analyze Text FREE
The core of SovrenAI. Send any text, get every sentence classified. No AI, no cost, deterministic results.
Request:
{ "text": "Your text here. Multiple sentences work." }
Response: Array of classified sentences, each with tier (0-12), tier_name, confidence (0-1), domain, and word_pills (per-word definitions).
Same as /api/analyze but optimized for bulk classification. Returns the full response.
{ "text": "Your text here." }
Returns classification plus document fingerprint (proof of original) and statistics. Use this when you need the full receipt.
{ "text": "Your document text here." }
Returns: sentences, barcode_sequence, merkle_root, stats (sentence count, fact count, opinion count).
Write & Generate PAID
AI-powered writing with built-in classification. Every generated sentence is verified.
{ "message": "Write a summary of climate change impacts.", "session_id": "your-session-id" }
Returns Server-Sent Events (SSE): status, delta (streaming text), done (final classification + score).
{ "topic": "quantum computing", "format": "article" }
Writes a complete document, classifying every sentence as it goes. Returns structured sections with ratings.
Certify & Prove PAID
Register documents, generate tamper-evident proofs, compare texts.
{ "text": "Your document text.", "title": "My Report" }
Returns: doc_id (DOC-XXXXXXXXXXXX), barcode, sentence_count, tier_distribution, avg_confidence.
The DOC- ID is permanent. Change one word and re-registering produces a different ID. That's how tamper detection works.
{ "text_a": "First document text.", "text_b": "Second document text." }
Returns: Vocabulary overlap (Jaccard), rating similarity (cosine), word-level diff.
{ "text": "Any text." }
Returns a deterministic fingerprint string. Same text always produces the same fingerprints.
{ "tokens": [{"barcode":"WRD-XXXX","word":"hello","type":"word"}, ...] }
Reconstructs the original text from its fingerprint token sequence (as returned by /api/registry/encode).
Search PAID
{ "query": "quantum computing applications" }
Searches 834K+ verified words and returns matching content with ratings.
Words & Definitions FREE
Look up any word in the 834K-word verified dictionary.
GET /api/pills/gravity
Returns: Definition, part of speech, semantic category (science, law, etc.), synonyms, related words, etymology, and the word's unique fingerprint.
{ "query": "quantum", "limit": 10 }
Full-text search across 834K words. Returns matching definitions with categories, domains, and fingerprints.
Documents PAID
{ "title": "My Report", "content": "Document text..." }
GET /api/documents?limit=20&offset=0
ToBi Agent PAID
Natural language interface to the entire system. Tell ToBi what to do and it executes.
{ "message": "classify this: Water boils at 100 degrees.", "session_id": "my-session" }
ToBi understands natural language: "classify this", "certify my document", "search for climate change", "compare these two texts".
For complex requests: "research quantum computing, summarize it, then certify the summary" — ToBi chains multiple API calls automatically.
Billing FREE
GET /api/billing/status
Returns: plan, label, generations_used, generations_limit, certifications_used, certifications_limit.
System FREE
GET /api/health
Returns server status, word count, version, uptime. No auth required.
CLI Tools
194 command-line scripts for development, analysis, and system management. Key ones:
| Command | What it does |
|---|---|
python3 -m scripts.atomize_codebase | Index source code into the system |
python3 -m scripts.check_goals --summary | Check what's built and what's left |
python3 -m scripts.verify_barcodes --all | Verify all fingerprints are intact |
python3 -m scripts.firing_order | Run full quality checks on the codebase |
python3 -m scripts.ua_health --fix | Check and fix cross-link health |
python3 -m scripts.check_work_orders | Find stale specs and outdated work orders |
bash scripts/test_changed.sh | Run tests for changed files only |
bash scripts/test_core.sh | Core regression suite (~90 seconds) |
Error Codes
| Code | Meaning | What to do |
|---|---|---|
| 400 | Bad request — missing or invalid parameters | Check the request body matches the expected format |
| 401 | Not authenticated | Add your API key to the Authorization header |
| 403 | Not authorized — session belongs to another user | Use your own session ID |
| 429 | Rate limited or over plan limit | Wait for Retry-After seconds, or upgrade your plan |
| 500 | Server error | Retry once, then contact support |
Webhooks
SovrenAI sends webhook events for billing changes. Configure your webhook URL in Settings.
| Event | When |
|---|---|
checkout.session.completed | User completes subscription checkout |
customer.subscription.updated | Plan changed (upgrade/downgrade/renewal) |
customer.subscription.deleted | Subscription cancelled |
invoice.payment_failed | Payment failed |