TruthCrawl API Documentation

TruthCrawl exposes a RESTful HTTP API for programmatic search, AI chat, system monitoring, and distributed node management. All endpoints return JSON.

Authentication

Public endpoints (search, health) require no authentication. Write and control operations require a valid API key supplied as an X-Api-Key header or Authorization: Bearer <key>.

Core Endpoints

GET /api/search

Full-text web search against the TruthCrawl index. Returns ranked results with BM25F scores, TruthRank authority scores, freshness signals, and snippet previews.

Parameters: q (query string, required), page (default 1), limit (default 10, max 50), lang (language filter).

POST /api/ai/chat

Conversational AI assistant powered by OpenRouter. Streams responses with web-search context from the TruthCrawl index. Supports multi-turn conversation history.

GET /api/stats

Index statistics: total pages indexed, total domains known, crawl queue size, active crawler workers, average query time, and crawler status. Updated in real-time.

GET /api/health

Health check: database connectivity, crawler state, operational mode, and uptime in seconds.

GET /api/nodes

List all registered distributed nodes with their status (Active/Offline), storage capacity, last sync time, and pages indexed per node.

POST /api/nodes/register

Register a new crawl node with the coordinator. Requires node identifier, endpoint URL, and storage capacity. Returns authentication credentials for the node.

GET /api/trending

Returns anonymised trending search terms based on aggregate query frequencies. No user identifiers are stored or returned.

Rate Limits

Search API: 60 requests/minute per IP. AI chat: 20 requests/minute. Node sync: unlimited for authenticated nodes.

Base URL

All API endpoints are available at the root of the TruthCrawl domain, e.g. https://truthcrawl.com/api/search?q=example.