Base URL
- Local:
http://localhost:8787 - Production:
https://parti.metacogna.ai
Authentication
All authenticated endpoints require a session cookie:Endpoints
Health & Debug
GET /
Service information and available endpoints.GET /api/health
Health check endpoint.Authentication
POST /api/auth/login
User login with SHA-256 hashed credentials.Password must be SHA-256 hashed:
SHA256(username + password)POST /api/signup
Admin-only endpoint to create new users.multipart/form-data
- Goals are automatically summarized using Workers AI
- Files are uploaded to R2:
users/{userId}/documents/{docId}-{filename} - User ID is generated as UUID v4
Documents
POST /api/ingest
Upload documents for indexing.multipart/form-data
- Chunking (0-29%) - Text splitting into semantic chunks
- Embedding (30-59%) - Vector embedding generation
- Graph Extraction (60-89%) - Entity and relationship extraction
- Finalizing (90-100%) - Final indexing
GET /api/documents
Get all documents for authenticated user. Status Values:processing- Ingestion in progressindexed- Successfully indexederror- Ingestion failed
POST /api/documents/reindex
Reindex all documents (maintenance operation).DELETE /api/documents/purge-errors
Remove all documents with error status.Search
GET /api/search
Semantic vector search.string
Search query string
string
User ID for filtering
number
default:"5"
Number of results to return
Knowledge Graph
GET /api/graph
Get knowledge graph nodes and relationships.string
User ID for filtering
Rate Limiting
Chat endpoint has rate limiting:- Limit: 10 requests per minute per user
- Headers:
X-RateLimit-Remaining,X-RateLimit-Reset - Status:
429when limit exceeded
Error Responses
All errors follow this format:400- Bad Request (validation errors)401- Unauthorized (authentication required)404- Not Found429- Too Many Requests (rate limit exceeded)500- Internal Server Error
Related Documentation
- Chat Endpoint - Detailed chat API documentation
- Backend Worker - Worker implementation details