SOVRENAI Home Guides Developers Open App

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:

PlanRequests/minAI Generations/moCertifications/moPrice
Free Trial10505$0 (15 days)
Starter3080050$10/mo
Pro601,600200$20/mo
Business1202,400Unlimited$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.

POST /api/analyze Classify any text — full analysis

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

POST /api/classify Fast classification — bare minimum, fastest response

Same as /api/analyze but optimized for bulk classification. Returns the full response.

{ "text": "Your text here." }
POST /api/receipt Full truth receipt — classify + fingerprint + proof

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.

POST /chat/stream Chat with AI — streams classified response via SSE
{ "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).

POST /api/compile Build a verified document from a topic
{ "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.

POST /api/registry Register a document — get a DOC- ID + proof of original
{ "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.

POST /api/registry/compare Compare two documents
{ "text_a": "First document text.", "text_b": "Second document text." }

Returns: Vocabulary overlap (Jaccard), rating similarity (cosine), word-level diff.

POST /api/registry/encode Encode text to fingerprint sequence
{ "text": "Any text." }

Returns a deterministic fingerprint string. Same text always produces the same fingerprints.

POST /api/registry/decode Decode fingerprint sequence back to text
{ "tokens": [{"barcode":"WRD-XXXX","word":"hello","type":"word"}, ...] }

Reconstructs the original text from its fingerprint token sequence (as returned by /api/registry/encode).

POST /api/search Search internal knowledge base
{ "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/{word} Look up a word — definition, category, related words
GET /api/pills/gravity

Returns: Definition, part of speech, semantic category (science, law, etc.), synonyms, related words, etymology, and the word's unique fingerprint.

POST /api/product/search Search the dictionary
{ "query": "quantum", "limit": 10 }

Full-text search across 834K words. Returns matching definitions with categories, domains, and fingerprints.

Documents PAID

POST /api/documents Create a new document
{ "title": "My Report", "content": "Document text..." }
GET /api/documents List all documents
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.

POST /api/toby Send an instruction — ToBi executes it
{ "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 Current plan and usage
GET /api/billing/status

Returns: plan, label, generations_used, generations_limit, certifications_used, certifications_limit.

System FREE

GET /api/health Server status
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:

CommandWhat it does
python3 -m scripts.atomize_codebaseIndex source code into the system
python3 -m scripts.check_goals --summaryCheck what's built and what's left
python3 -m scripts.verify_barcodes --allVerify all fingerprints are intact
python3 -m scripts.firing_orderRun full quality checks on the codebase
python3 -m scripts.ua_health --fixCheck and fix cross-link health
python3 -m scripts.check_work_ordersFind stale specs and outdated work orders
bash scripts/test_changed.shRun tests for changed files only
bash scripts/test_core.shCore regression suite (~90 seconds)

Error Codes

CodeMeaningWhat to do
400Bad request — missing or invalid parametersCheck the request body matches the expected format
401Not authenticatedAdd your API key to the Authorization header
403Not authorized — session belongs to another userUse your own session ID
429Rate limited or over plan limitWait for Retry-After seconds, or upgrade your plan
500Server errorRetry once, then contact support

Webhooks

SovrenAI sends webhook events for billing changes. Configure your webhook URL in Settings.

EventWhen
checkout.session.completedUser completes subscription checkout
customer.subscription.updatedPlan changed (upgrade/downgrade/renewal)
customer.subscription.deletedSubscription cancelled
invoice.payment_failedPayment failed

Ready to build?

Get your API key and start classifying text in 30 seconds.

Get API Key