API Reference
API Reference
FastAPI REST API endpoint reference for the RAG system
API Reference
The RAG system exposes a FastAPI REST API with full OpenAPI documentation.
Base URL: http://localhost:9000
API Prefix: /api/v1
Authentication
All endpoints except health checks require an API key in the X-API-Key header:
curl -H "X-API-Key: your-secret-key" http://localhost:9000/api/v1/queryExempt paths: /, /docs, /redoc, /openapi.json, /api/v1/health/*
When API_KEYS is empty in .env, authentication is disabled (development mode).
Endpoint Overview
| Group | Endpoints | Description |
|---|---|---|
| Health | GET /health, /health/ready, /health/stats | System health and readiness |
| Query | POST /query, POST /search | RAG query and semantic search |
| Documents | GET/DELETE /documents/* | Document CRUD operations |
| Scrape | POST /scrape, POST /scrape/async | URL web scraping |
| Upload | POST /upload, /upload/async, /upload/bulk | File uploads |
| Parse | POST /parse, /parse/formats, /parse/sections, /parse/sections/stream, /parse/sections/incremental | Document parsing and semantic chunking |
| Tasks | GET/DELETE /tasks/* | Background task monitoring |
Error Format
All errors follow a consistent JSON format:
{
"error": "Error type",
"detail": "Detailed error message",
"status_code": 400,
"timestamp": "2025-01-15T10:30:00.000000"
}HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
400 | Bad request (invalid parameters) |
401 | Missing API key |
403 | Invalid API key |
404 | Resource not found |
500 | Internal server error |
Interactive Documentation
Once the server is running:
- Swagger UI: http://localhost:9000/docs
- ReDoc: http://localhost:9000/redoc
- OpenAPI JSON: http://localhost:9000/openapi.json