Introduction
Reflect AI provides a simple REST API for managing journal entries, retrieving insights, and accessing AI features.Base URL
All API requests are made to:The API runs locally on your machine. It’s not accessible from the internet.
Architecture
Local-First Design
- Flask backend serves the REST API
- JSON storage for all journal data
- NLTK/VADER for local sentiment analysis
- Groq API for optional AI features
Request/Response Format
All endpoints accept and return JSON:Authentication
No authentication required. Reflect AI is designed for single-user, local use.
- Single user
- Trusted local environment
- No remote access
API Categories
Entry Management
Entries
Create, read, update, and delete journal entries
Export/Import
Backup and restore your journal data
Analytics & Insights
Stats
Streak tracking, mood distribution, badges
Insights
Charts, summaries, and pattern analysis
AI Features
Greeting
Personalized greetings based on your journaling habits
Response Format
Success Response
Successful requests return JSON with appropriate status codes:Error Response
Errors return a JSON object with anerror field:
HTTP Status Codes
Successful request
Invalid input or parameters
Entry or resource not found
Server error (check logs)
CORS
CORS is enabled for all origins to allow the frontend to communicate with the API.Error Handling
All endpoints use a consistent error handling decorator:Data Validation
The API validates:- Date formats: Must be
YYYY-MM-DD - Text length: Max 50,000 characters
- Photo limits: Max 10 per entry
- Tag limits: Max 10 tags, 30 chars each
Rate Limiting
No rate limiting. Since the API is local-only, there’s no need for rate limits.
API Conventions
Date Keys
Entries are keyed by date inYYYY-MM-DD format:
Query Parameters
Some endpoints accept query parameters:Automatic Processing
When you save an entry, the API automatically:- Analyzes sentiment (local, using VADER)
- Extracts themes (local, keyword-based)
- Counts words
- Adds timestamp
- Returns empathetic response
Testing the API
Using cURL
Using JavaScript
Using Python
Next Steps
Entries API
Learn about entry management
Stats API
Explore analytics endpoints
Insights API
Discover pattern analysis