Skip to main content

API Reference

All APIs are Next.js Route Handlers under src/app/api/. Authentication is enforced via Supabase JWT middleware on all routes except public ones.

Internal API Routes

Search & Analysis

EndpointMethodAuthDescriptionMax Duration
/api/queryPOSTYesMain search — direct or playbook mode60s
/api/playbookPOSTYesDeep 4-lens analysis (SSE stream)120s
/api/citations/searchGETYesCitation lookup

Threads

EndpointMethodAuthDescription
/api/threadsGET/POSTYesList/create threads
/api/threads/[id]GET/PATCHYesGet/update thread
/api/threads/[id]/beliefsGET/POSTYesManage saved beliefs
/api/threads/[id]/sharePOSTYesPublish thread, get share URL
/api/threads/topGETYesPopular community threads

Graph & Analytics

EndpointMethodAuthDescription
/api/graph/dataGETYesSpeaker nodes + similarity links (1h cache)
/api/marketGETYesBTC price + Fear & Greed index
/api/feedGETYesCommunity cards (cursor-based pagination)

Auth & Admin

EndpointMethodAuthDescription
/api/auth/logoutPOSTYesEnd session
/auth/callbackGETNoOAuth callback
/api/invite/claimPOSTYesClaim beta invite code
/api/alertsGET/POSTYesAlert management
/api/notificationsGETYesUser notifications
/api/cron/check-alertsGETCronDaily alert check (8 AM)

External Service APIs

ServicePurposeAuth
SupabaseDB, Auth, StorageAnon key + Service role key
Qdrant CloudVector similarity searchAPI key header
OpenAI (GPT-4o)Query synthesis + analysisAPI key
OpenAI (Embeddings)text-embedding-3-largeAPI key
DeepSeekOptional reasoning modelAPI key
TavilyWeb search for Jackal (planned)API key
HuggingFaceDataset syncHF token

MCP Server

The project includes a Model Context Protocol server for use with Claude Desktop, Cursor, and other MCP clients.

10 Tools Available:

ToolDescription
search_transcriptsSemantic search over transcript chunks
get_episode_contextWindow around a timestamp
get_speaker_turnsAll speaking turns in an episode
get_episode_summaryEpisode metadata
semantic_searchExploratory vector search
search_beliefsBeliefs by speaker/topic
get_timelineTemporal distribution
get_sentimentSentiment analysis
compare_speakersCompare perspectives
get_similar_speakersCo-occurrence clustering

Run locally:

npm run mcp:build && node dist/mcp/server.js
# or with inspector
npm run mcp:inspect

Uses DuckDB in-memory with parquet files for fast local queries.