This document outlines all available API endpoints for the MindWell application. The API follows RESTful principles and uses JSON for request/response bodies.
All protected endpoints require Clerk authentication. Authentication is handled via middleware and session cookies.
Authorization: Bearer <clerk_session_token>
POST /api/symptoms
Content-Type: application/json
{
"name": "ANXIETY",
"intensity": 7,
"frequency": "DAILY"
}Response (200):
{
"id": "symptom_123",
"userId": "user_456",
"name": "ANXIETY",
"intensity": 7,
"frequency": "DAILY",
"loggedAt": "2024-06-15T10:30:00Z"
}GET /api/symptoms?limit=10&offset=0Response (200):
{
"data": [
{
"id": "symptom_123",
"name": "ANXIETY",
"intensity": 7,
"frequency": "DAILY",
"loggedAt": "2024-06-15T10:30:00Z"
}
],
"total": 15,
"limit": 10,
"offset": 0
}GET /api/symptoms/:idResponse (200):
{
"id": "symptom_123",
"userId": "user_456",
"name": "ANXIETY",
"intensity": 7,
"frequency": "DAILY",
"loggedAt": "2024-06-15T10:30:00Z"
}DELETE /api/symptoms/:idResponse (200):
{
"message": "Symptom deleted successfully",
"id": "symptom_123"
}POST /api/medications
Content-Type: application/json
{
"name": "Sertraline",
"dosage": "50mg",
"purpose": "Anxiety management",
"frequency": "DAILY",
"adherence": "ALWAYS",
"startDate": "2024-01-15"
}Response (201):
{
"id": "med_789",
"userId": "user_456",
"name": "Sertraline",
"dosage": "50mg",
"purpose": "Anxiety management",
"frequency": "DAILY",
"adherence": "ALWAYS",
"startDate": "2024-01-15"
}GET /api/medicationsResponse (200):
{
"data": [
{
"id": "med_789",
"name": "Sertraline",
"dosage": "50mg",
"purpose": "Anxiety management",
"frequency": "DAILY",
"adherence": "ALWAYS"
}
]
}PUT /api/medications/:id
Content-Type: application/json
{
"adherence": "SOMETIMES"
}Response (200):
{
"id": "med_789",
"adherence": "SOMETIMES",
"message": "Medication updated successfully"
}DELETE /api/medications/:idResponse (200):
{
"message": "Medication deleted successfully",
"id": "med_789"
}POST /api/wellness
Content-Type: application/json
{
"mood": "HAPPY",
"happiness": 8,
"sleep": "GOOD",
"stress": "SLIGHTLY",
"anxiety": "Feeling good today"
}Response (201):
{
"id": "wellness_101",
"userId": "user_456",
"mood": "HAPPY",
"happiness": 8,
"sleep": "GOOD",
"stress": "SLIGHTLY",
"anxiety": "Feeling good today",
"createdAt": "2024-06-15T14:20:00Z"
}GET /api/wellness?days=30Response (200):
{
"data": [
{
"id": "wellness_101",
"mood": "HAPPY",
"happiness": 8,
"sleep": "GOOD",
"stress": "SLIGHTLY",
"createdAt": "2024-06-15T14:20:00Z"
}
],
"averageMood": 7.5,
"averageHappiness": 7.8
}POST /api/chat
Content-Type: application/json
{
"message": "How can I manage my anxiety naturally?"
}Response (200):
{
"role": "model",
"content": "Here are some natural ways to manage anxiety...",
"id": "msg_202",
"createdAt": "2024-06-15T15:45:00Z"
}GET /api/chat?limit=50Response (200):
{
"data": [
{
"id": "msg_202",
"role": "user",
"content": "How can I manage my anxiety?",
"createdAt": "2024-06-15T15:44:00Z"
},
{
"id": "msg_203",
"role": "model",
"content": "Here are some suggestions...",
"createdAt": "2024-06-15T15:45:00Z"
}
]
}DELETE /api/chatResponse (200):
{
"message": "Chat history cleared successfully"
}POST /api/activities
Content-Type: application/json
{
"name": "Morning Meditation",
"description": "10 minutes of daily meditation",
"colorCode": "#FF6B6B"
}Response (201):
{
"id": "activity_301",
"userId": "user_456",
"name": "Morning Meditation",
"description": "10 minutes of daily meditation",
"colorCode": "#FF6B6B",
"createdAt": "2024-06-15T08:00:00Z"
}GET /api/activitiesResponse (200):
{
"data": [
{
"id": "activity_301",
"name": "Morning Meditation",
"description": "10 minutes of daily meditation",
"colorCode": "#FF6B6B",
"createdAt": "2024-06-15T08:00:00Z"
}
]
}POST /api/activities/:id/log
Content-Type: application/json
{
"count": 1,
"date": "2024-06-15"
}Response (201):
{
"id": "activityLog_401",
"activityId": "activity_301",
"date": "2024-06-15",
"count": 1,
"message": "Activity logged successfully"
}GET /api/activities/:id/logs?startDate=2024-06-01&endDate=2024-06-30Response (200):
{
"activityId": "activity_301",
"logs": [
{
"id": "activityLog_401",
"date": "2024-06-15",
"count": 1
}
],
"stats": {
"totalLogs": 15,
"currentStreak": 5,
"longestStreak": 12,
"averageCount": 1.3
}
}GET /api/activities/:id/statsResponse (200):
{
"activityId": "activity_301",
"name": "Morning Meditation",
"currentStreak": 5,
"longestStreak": 12,
"totalLogs": 15,
"thisWeek": 6,
"thisMonth": 25
}PUT /api/activities/:id
Content-Type: application/json
{
"name": "Morning Meditation (Updated)",
"colorCode": "#4ECDC4"
}Response (200):
{
"id": "activity_301",
"name": "Morning Meditation (Updated)",
"colorCode": "#4ECDC4",
"message": "Activity updated successfully"
}DELETE /api/activities/:idResponse (200):
{
"message": "Activity deleted successfully",
"id": "activity_301"
}GET /api/user/profileResponse (200):
{
"id": "user_456",
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"age": 28,
"gender": "Male",
"height": 180,
"weight": 75,
"bloodGroup": "O+",
"medicalIssues": "Mild anxiety",
"createdAt": "2024-01-15T10:00:00Z"
}PUT /api/user/profile
Content-Type: application/json
{
"age": 29,
"weight": 73,
"medicalIssues": "Managed anxiety"
}Response (200):
{
"message": "Profile updated successfully",
"user": {
"id": "user_456",
"age": 29,
"weight": 73,
"medicalIssues": "Managed anxiety"
}
}DELETE /api/user/profileResponse (200):
{
"message": "Account deleted successfully. All associated data has been removed."
}GET /api/dashboard/overview?dateRange=30Response (200):
{
"totalActivities": 15,
"currentStreak": 7,
"averageMood": 7.2,
"medicalIssues": 3,
"medications": 2,
"thisWeekLogs": 20
}GET /api/dashboard/health-statusResponse (200):
{
"symptoms": {
"total": 8,
"recent": "ANXIETY, STRESS"
},
"medications": {
"total": 2,
"adherenceRate": 85
},
"wellness": {
"avgMood": 7.2,
"avgHappiness": 7.5,
"avgSleep": "GOOD"
}
}GET /api/dashboard/activity-heatmapResponse (200):
{
"data": [
{
"date": "2024-06-15",
"count": 5,
"level": "high"
}
]
}{
"error": "Unauthorized",
"message": "You must be logged in to access this resource",
"statusCode": 401
}{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"statusCode": 403
}{
"error": "Not Found",
"message": "The requested resource was not found",
"statusCode": 404
}{
"error": "Validation Error",
"message": "Invalid input provided",
"details": {
"intensity": "Must be between 1 and 10"
},
"statusCode": 422
}{
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"statusCode": 500
}| Status | Meaning |
|---|---|
| 200 | OK - Request successful |
| 201 | Created - Resource created successfully |
| 204 | No Content - Request successful, no response body |
| 400 | Bad Request - Invalid request format |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource not found |
| 422 | Unprocessable Entity - Validation failed |
| 500 | Internal Server Error - Server error |
- Free Tier: 100 requests per hour
- Premium Tier: 1000 requests per hour
Rate limit information is included in response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1623798000
For list endpoints, use these query parameters:
GET /api/symptoms?limit=20&offset=0&sort=createdAt&order=descParameters:
limit: Number of results (max 100, default 20)offset: Number of results to skip (default 0)sort: Field to sort byorder: Sort order (asc/desc)
The API supports CORS requests from:
http://localhost:3000(development)https://mindwell.app(production)
Currently, the API is accessed directly via HTTP. SDKs for popular languages coming soon.
For API issues or questions:
- GitHub Issues: Report a bug
- Email: support@mindwell.app