{"openapi":"3.0.0","info":{"title":"Personal Expense Tracker API","version":"1.0.0","description":"Health, authentication, expense, budget, and authenticated reports endpoints."},"servers":[{"url":"/"}],"tags":[{"name":"Health","description":"Service health checks"},{"name":"Authentication","description":"Account and session management"},{"name":"Expenses","description":"Authenticated expense management"},{"name":"Reports","description":"Authenticated calendar-period reports"},{"name":"Budget","description":"Standing monthly spending limits"}],"components":{"securitySchemes":{"sessionCookie":{"type":"apiKey","in":"cookie","name":"expense_tracker_session"}},"schemas":{"User":{"type":"object","required":["id","name","email","currency","timezone"],"properties":{"id":{"type":"string","example":"68e76d650be2674af17641d2"},"name":{"type":"string","example":"Sam Example"},"email":{"type":"string","format":"email","example":"sam@example.com"},"currency":{"type":"string","example":"BDT"},"timezone":{"type":"string","example":"Asia/Dhaka"}}},"Expense":{"type":"object","required":["id","title","amountMinor","currency","category","expenseDate","createdAt","updatedAt"],"properties":{"id":{"type":"string","example":"68e76d650be2674af17641d2"},"title":{"type":"string","maxLength":120},"amountMinor":{"type":"integer","format":"int64","minimum":1,"description":"BDT paisa; ৳125.50 is represented as 12550."},"currency":{"type":"string","enum":["BDT"]},"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"expenseDate":{"type":"string","format":"date","description":"Calendar date in YYYY-MM-DD."},"paymentMethod":{"type":"string","enum":["cash","card","mobile_banking","bank_transfer"]},"note":{"type":"string","maxLength":1000},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CategoryBreakdown":{"type":"object","required":["category","totalMinor","expenseCount"],"properties":{"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0}}},"DailyReport":{"type":"object","required":["period","currency","totalMinor","expenseCount","averageExpenseMinor","categoryBreakdown"],"properties":{"period":{"type":"object","required":["type","date","timezone"],"properties":{"type":{"type":"string","enum":["daily"]},"date":{"type":"string","format":"date"},"timezone":{"type":"string","example":"Asia/Dhaka"}}},"currency":{"type":"string","enum":["BDT"]},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"averageExpenseMinor":{"type":"integer","format":"int64","minimum":0},"categoryBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/CategoryBreakdown"}}}},"MonthlyReport":{"type":"object","required":["period","currency","totalMinor","expenseCount","categoryBreakdown","dailyBreakdown"],"properties":{"period":{"type":"object","required":["type","year","month","from","to","timezone"],"properties":{"type":{"type":"string","enum":["monthly"]},"year":{"type":"integer","minimum":1900,"maximum":9999},"month":{"type":"integer","minimum":1,"maximum":12},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"timezone":{"type":"string","example":"Asia/Dhaka"}}},"currency":{"type":"string","enum":["BDT"]},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"categoryBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/CategoryBreakdown"}},"dailyBreakdown":{"type":"array","description":"Every calendar date in the month, zero-filled.","items":{"type":"object","required":["date","totalMinor","expenseCount"],"properties":{"date":{"type":"string","format":"date"},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0}}}}}},"YearlyReport":{"type":"object","required":["period","currency","totalMinor","expenseCount","categoryBreakdown","monthlyBreakdown"],"properties":{"period":{"type":"object","required":["type","year","from","to","timezone"],"properties":{"type":{"type":"string","enum":["yearly"]},"year":{"type":"integer","minimum":1900,"maximum":9999},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"timezone":{"type":"string","example":"Asia/Dhaka"}}},"DashboardOverview":{"type":"object","required":["timezone","date","currency","today","month","yearToDate","dailyTrend","categoryBreakdown"],"properties":{"timezone":{"type":"string","example":"Asia/Dhaka"},"date":{"type":"string","format":"date"},"currency":{"type":"string","enum":["BDT"]},"today":{"type":"object","required":["totalMinor","expenseCount"],"properties":{"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0}}},"month":{"type":"object","required":["totalMinor","expenseCount","from","to"],"properties":{"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}},"yearToDate":{"type":"object","required":["totalMinor","expenseCount","from","to"],"properties":{"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}},"monthToDate":{"type":"object","description":"From the 1st of the month up to and including `date`.","properties":{"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}},"previousMonthToDate":{"type":"object","description":"The same days of the previous month, clipped to its length.","properties":{"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}},"comparison":{"type":"object","properties":{"changeMinor":{"type":"integer","format":"int64"},"changePercent":{"type":"number","nullable":true,"description":"One decimal place; null when last month had no spending."}}},"insights":{"type":"object","properties":{"daysElapsed":{"type":"integer"},"daysInMonth":{"type":"integer"},"daysRemaining":{"type":"integer","description":"Including today."},"dailyAverageMinor":{"type":"integer","format":"int64"},"projectedMonthMinor":{"type":"integer","format":"int64","description":"Month-to-date pace over the whole month, plus expenses already dated later this month."}}},"budget":{"type":"object","nullable":true,"description":"Null when the user has not set a budget.","properties":{"limitMinor":{"type":"integer","format":"int64","nullable":true},"spentMinor":{"type":"integer","format":"int64"},"remainingMinor":{"type":"integer","format":"int64","nullable":true},"percentUsed":{"type":"number","nullable":true},"status":{"type":"string","enum":["on_track","at_risk","over"],"nullable":true},"safeDailySpendMinor":{"type":"integer","format":"int64","nullable":true},"categories":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"limitMinor":{"type":"integer","format":"int64"},"spentMinor":{"type":"integer","format":"int64"},"remainingMinor":{"type":"integer","format":"int64"},"percentUsed":{"type":"number"},"status":{"type":"string","enum":["ok","warning","over"],"description":"`warning` from 80% of the limit."}}}}}},"paymentMethodBreakdown":{"type":"array","items":{"type":"object","properties":{"paymentMethod":{"type":"string","enum":["cash","card","mobile_banking","bank_transfer","unspecified"]},"totalMinor":{"type":"integer","format":"int64"},"expenseCount":{"type":"integer"}}}},"dailyTrend":{"type":"array","description":"Every day of the selected month, zero-filled.","items":{"type":"object","required":["date","totalMinor","expenseCount"],"properties":{"date":{"type":"string","format":"date"},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0}}}},"categoryBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/CategoryBreakdown"}}}},"currency":{"type":"string","enum":["BDT"]},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0},"categoryBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/CategoryBreakdown"}},"monthlyBreakdown":{"type":"array","description":"All twelve calendar months, zero-filled.","items":{"type":"object","required":["month","totalMinor","expenseCount"],"properties":{"month":{"type":"integer","minimum":1,"maximum":12},"totalMinor":{"type":"integer","format":"int64","minimum":0},"expenseCount":{"type":"integer","minimum":0}}}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","required":["field","message"],"properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}},"paths":{"/api/v1/budget":{"get":{"tags":["Budget"],"summary":"Get the current user's standing monthly budget","operationId":"getBudget","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"The budget; empty values when none is set","content":{"application/json":{"schema":{"type":"object","required":["budget"],"properties":{"budget":{"type":"object","properties":{"monthlyLimitMinor":{"type":"integer","format":"int64","nullable":true},"categoryLimits":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"limitMinor":{"type":"integer","format":"int64"}}}},"updatedAt":{"type":"string","format":"date-time","nullable":true}}}}}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["Budget"],"summary":"Replace the monthly budget","description":"Applies to every calendar month. Categories left out of `categoryLimits` have no limit. Clearing every limit removes the budget.","operationId":"saveBudget","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["monthlyLimit"],"additionalProperties":false,"properties":{"monthlyLimit":{"type":"string","nullable":true,"example":"30000.00"},"categoryLimits":{"type":"object","additionalProperties":{"type":"string"},"example":{"food_dining":"8000","groceries":"6000"}}}}}}},"responses":{"200":{"description":"The saved budget","content":{"application/json":{"schema":{"type":"object","required":["budget"],"properties":{"budget":{"type":"object","properties":{"monthlyLimitMinor":{"type":"integer","format":"int64","nullable":true},"categoryLimits":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"limitMinor":{"type":"integer","format":"int64"}}}},"updatedAt":{"type":"string","format":"date-time","nullable":true}}}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/expenses/export":{"get":{"tags":["Expenses"],"summary":"Download the current user's expenses as CSV","description":"Uses the same filters and sorting as the list endpoint, without pagination. Capped at 10,000 rows; `X-Export-Truncated: true` means more matched.","operationId":"exportExpenses","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"from","schema":{"type":"string","format":"date"}},{"in":"query","name":"to","schema":{"type":"string","format":"date"}},{"in":"query","name":"category","schema":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]}},{"in":"query","name":"paymentMethod","schema":{"type":"string","enum":["cash","card","mobile_banking","bank_transfer"]}},{"in":"query","name":"q","schema":{"type":"string","maxLength":100},"description":"Case-insensitive title search."},{"in":"query","name":"sortBy","schema":{"type":"string","enum":["expenseDate","createdAt","title","amountMinor"],"default":"expenseDate"}},{"in":"query","name":"sortOrder","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"UTF-8 CSV with a byte-order mark","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/overview":{"get":{"tags":["Reports"],"summary":"Get dashboard totals and current-month breakdowns","operationId":"getDashboardOverview","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"date","required":true,"schema":{"type":"string","format":"date","example":"2026-10-17"},"description":"Local calendar date in YYYY-MM-DD format."}],"responses":{"200":{"description":"Daily, full calendar month, year-to-date totals, current-month daily trend and category totals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardOverview"}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/daily":{"get":{"tags":["Reports"],"summary":"Get spending totals for one calendar date","operationId":"getDailyReport","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"date","required":true,"schema":{"type":"string","format":"date","example":"2026-10-17"}}],"responses":{"200":{"description":"Daily totals and category spending; average minor units are rounded to nearest integer, ties up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyReport"}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/monthly":{"get":{"tags":["Reports"],"summary":"Get spending totals for a calendar month","operationId":"getMonthlyReport","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"year","required":true,"schema":{"type":"integer","minimum":1900,"maximum":9999}},{"in":"query","name":"month","required":true,"schema":{"type":"integer","minimum":1,"maximum":12}}],"responses":{"200":{"description":"Monthly totals, category breakdown and every day of the month, zero-filled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyReport"}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/yearly":{"get":{"tags":["Reports"],"summary":"Get spending totals for a calendar year","operationId":"getYearlyReport","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"year","required":true,"schema":{"type":"integer","minimum":1900,"maximum":9999}}],"responses":{"200":{"description":"Yearly totals, category breakdown and all twelve months, zero-filled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/YearlyReport"}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/health":{"get":{"tags":["Health"],"summary":"Check API liveness","operationId":"getHealth","responses":{"200":{"description":"The API process is running","content":{"application/json":{"schema":{"type":"object","required":["status","service","timestamp"],"properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string","enum":["personal-expense-tracker-api"]},"timestamp":{"type":"string","format":"date-time"}}}}}}}}},"/api/v1/auth/register":{"post":{"tags":["Authentication"],"summary":"Register an account and start a session","operationId":"register","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"},"description":"Must exactly match the configured web origin."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","email","password"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"email":{"type":"string","format":"email","maxLength":254},"password":{"type":"string","minLength":8,"maxLength":72}}}}}},"responses":{"200":{"description":"An existing unverified account was sent a new verification code","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"expiresAt":{"type":"string","format":"date-time","description":"When the emailed verification code stops working. Omitted when no code was sent."},"otp":{"type":"string","description":"Development-only verification code"}}}}}},"201":{"description":"Account created; email verification is required","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"expiresAt":{"type":"string","format":"date-time","description":"When the emailed verification code stops working. Omitted when no code was sent."},"otp":{"type":"string","description":"Development-only verification code"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["Authentication"],"summary":"Authenticate and start a session","operationId":"login","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"},"description":"Must exactly match the configured web origin."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email","maxLength":254},"password":{"type":"string","minLength":8,"maxLength":72}}}}}},"responses":{"200":{"description":"Authenticated; session cookie is set","headers":{"Set-Cookie":{"description":"HttpOnly, SameSite=Lax session cookie","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/verify-email":{"post":{"tags":["Authentication"],"summary":"Verify an email OTP and start a session","operationId":"verifyEmail","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","otp"],"properties":{"email":{"type":"string","format":"email"},"otp":{"type":"string","pattern":"^[0-9]{6}$"}}}}}},"responses":{"200":{"description":"Email verified; session cookie is set","content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/resend-email-otp":{"post":{"tags":["Authentication"],"summary":"Resend an email verification OTP","operationId":"resendEmailOtp","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Resend request completed","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"expiresAt":{"type":"string","format":"date-time","description":"When the emailed verification code stops working. Omitted when no code was sent."},"otp":{"type":"string","description":"Development-only verification code"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/forgot-password":{"post":{"tags":["Authentication"],"summary":"Request a password reset email","operationId":"forgotPassword","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"},"description":"Must exactly match the configured web origin."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email","maxLength":254}}}}}},"responses":{"200":{"description":"Always returned, whether or not an account matches. If one does, a reset link valid for 30 minutes is emailed to it. The token is never returned in the response.","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["Authentication"],"summary":"Reset a password using a valid token","operationId":"resetPassword","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"},"description":"Must exactly match the configured web origin."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token","password"],"properties":{"token":{"type":"string","minLength":1,"maxLength":512},"password":{"type":"string","minLength":8,"maxLength":72}}}}}},"responses":{"200":{"description":"Password reset successfully","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["Authentication"],"summary":"Revoke the current session","operationId":"logout","parameters":[{"in":"header","name":"Origin","required":true,"schema":{"type":"string"},"description":"Must exactly match the configured web origin."}],"security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Session revoked and cookie cleared","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["Authentication"],"summary":"Get the current authenticated user","operationId":"getCurrentUser","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Current user","content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Authentication"],"summary":"Update the current user's profile","operationId":"updateCurrentUser","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"timezone":{"type":"string","example":"Asia/Dhaka"}}}}}},"responses":{"200":{"description":"Updated user profile","content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/expenses":{"get":{"tags":["Expenses"],"summary":"List the current user's expenses","operationId":"listExpenses","security":[{"sessionCookie":[]}],"parameters":[{"in":"query","name":"from","schema":{"type":"string","format":"date"},"description":"Inclusive start date (YYYY-MM-DD)."},{"in":"query","name":"to","schema":{"type":"string","format":"date"},"description":"Inclusive end date (YYYY-MM-DD)."},{"in":"query","name":"category","schema":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]}},{"in":"query","name":"paymentMethod","schema":{"type":"string","enum":["cash","card","mobile_banking","bank_transfer"]}},{"in":"query","name":"q","schema":{"type":"string","maxLength":100},"description":"Case-insensitive title search."},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"default":1}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"in":"query","name":"sortBy","schema":{"type":"string","enum":["expenseDate","createdAt","title","amountMinor"],"default":"expenseDate"}},{"in":"query","name":"sortOrder","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Paginated expenses belonging to the current user","content":{"application/json":{"schema":{"type":"object","required":["items","pagination"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Expense"}},"pagination":{"type":"object","required":["page","limit","totalItems","totalPages"],"properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"totalItems":{"type":"integer"},"totalPages":{"type":"integer"}}},"summary":{"type":"object","description":"Totals across every page of the filtered results.","properties":{"totalMinor":{"type":"integer","format":"int64"}}}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Expenses"],"summary":"Create an expense for the current user","operationId":"createExpense","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","amount","category","expenseDate"],"properties":{"title":{"type":"string","minLength":1,"maxLength":120},"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,13})(?:\\.[0-9]{1,2})?$","example":"125.50","description":"Decimal BDT amount; converted to integer paisa without floating-point math."},"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"expenseDate":{"type":"string","format":"date"},"paymentMethod":{"type":"string","enum":["cash","card","mobile_banking","bank_transfer"]},"note":{"type":"string","maxLength":1000}}}}}},"responses":{"201":{"description":"Expense created","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"$ref":"#/components/schemas/Expense"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/expenses/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$"}}],"get":{"tags":["Expenses"],"summary":"Get one expense owned by the current user","operationId":"getExpense","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Expense details","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"$ref":"#/components/schemas/Expense"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Expenses"],"summary":"Update an expense owned by the current user","operationId":"updateExpense","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"title":{"type":"string","minLength":1,"maxLength":120},"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,13})(?:\\.[0-9]{1,2})?$","example":"150.00"},"category":{"type":"string","enum":["food_dining","transport","groceries","bills_utilities","shopping","health","education","entertainment","rent","travel","other"]},"expenseDate":{"type":"string","format":"date"},"paymentMethod":{"type":"string","nullable":true,"enum":["cash","card","mobile_banking","bank_transfer"]},"note":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Expense updated","content":{"application/json":{"schema":{"type":"object","required":["item"],"properties":{"item":{"$ref":"#/components/schemas/Expense"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Expenses"],"summary":"Delete an expense owned by the current user","operationId":"deleteExpense","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Expense deleted","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}},"400":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The request could not be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}