REST APIs for document management, conversational queries, authentication, and subscriptions.
Replace with your actual Railway deployment URL:
https://your-railway-url.up.railway.app/v1
Example:
https://finlens-backend-production.up.railway.app/v1
All API requests require authentication using JWT tokens in the Authorization header:
Authorization: Bearer <your-jwt-token>
POST /auth/signup
Content-Type: application/json
{
"email": "user@example.com",
"password": "securepassword",
"full_name": "John Doe"
}POST /auth/signin
Content-Type: application/json
{
"email": "user@example.com",
"password": "securepassword"
}Response:
{
"access_token": "eyJ...",
"refresh_token": "eyJ...",
"user": {
"id": "uuid",
"email": "user@example.com",
"full_name": "John Doe"
},
"expires_in": 3600
}GET /auth/me
Authorization: Bearer <token>POST /documents/upload
Content-Type: multipart/form-data
files: [file1.pdf, file2.pdf]
descriptions: ["Q1 2024 Financial Report", "Annual Report 2023"]Note: descriptions must be a JSON array string in form data.
Response:
{
"total": 2,
"successful": 2,
"failed": 0,
"results": [
{
"document_id": "uuid",
"status": "processing",
"message": "Document uploaded successfully",
"metadata": {
"company": "Apple",
"year": 2024,
"document_type": "10-K"
}
}
]
}GET /documents?limit=12&offset=0Response:
{
"documents": [
{
"id": "uuid",
"filename": "annual_report.pdf",
"status": "indexed",
"description": "2023 Annual Report",
"pages": 150,
"uploaded_at": "2024-01-15T10:30:00Z"
}
],
"total": 25,
"limit": 12,
"offset": 0
}GET /documents/{document_id}DELETE /documents/{document_id}POST /chat/query
Content-Type: application/json
{
"query": "What are Apple's revenue trends for the last 3 years?",
"session_id": "optional-session-uuid",
"messages": [
{
"role": "user",
"content": "Previous question"
},
{
"role": "assistant",
"content": "Previous answer"
}
]
}Response:
{
"text": "Apple's revenue has shown consistent growth over the past 3 years...",
"charts": [
{
"type": "line",
"data": {
"labels": ["2022", "2023", "2024"],
"datasets": [...]
}
}
],
"sources": [
{
"company": "Apple Inc.",
"ticker": "AAPL",
"year": 2024,
"document_type": "10-K",
"page": 45
}
],
"metadata": {
"processing_time": 1.2,
"chunks_retrieved": 8
}
}GET /chat/sessions?limit=50&offset=0GET /chat/sessions/{session_id}GET /users/meGET /users/me/usageResponse:
{
"queries_used_this_month": 1250,
"queries_limit": 5000,
"documents_uploaded": 15,
"documents_limit": 100,
"subscription_plan": "pro"
}GET /subscriptions/mePOST /subscriptions/create
Content-Type: application/json
{
"price_id": "price_xxx"
}GET /healthResponse:
{
"status": "healthy",
"version": "1.0.0",
"services": {
"supabase": "connected",
"qdrant": "connected",
"openai": "configured"
}
}GET /health/readyAll endpoints return standard HTTP status codes:
200- Success400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Rate Limited500- Internal Server Error
Error Response Format:
{
"detail": "Error description",
"error_code": "SPECIFIC_ERROR_CODE"
}Rate limiting is subscription-based. Users have monthly query limits based on their subscription tier. When limits are exceeded, requests return 429 Too Many Requests:
{
"error": "Usage limit exceeded",
"queries_used": 5000,
"query_limit": 5000,
"message": "You have reached your monthly query limit..."
}For API support, create an issue at: GitHub Issues