Banking Expense Processor API ENDPOINTS: GET /api/expenses Get all expenses (with optional filters) Query params: startDate, endDate, bank, merchant, category Example: GET /api/expenses?bank=SCB&startDate=2024-05-01&category=Food POST /api/expenses Create a new expense manually Body: { date, amount, merchant, description?, transaction_type?, bank?, category?, note? } Example: POST /api/expenses { "date": "2024-05-23", "amount": 1234.50, "merchant": "Starbucks", "category": "Food", "note": "Weekly coffee run" } GET /api/expenses/:id Get a specific expense by ID DELETE /api/expenses/:id Delete a specific expense GET /api/expenses/summary/merchant Get expense summary grouped by merchant GET /api/expenses/summary/date Get expense summary grouped by date GET /api/expenses/summary/total Get total expense statistics EMAIL INTEGRATION: The worker receives banking emails from: - SCB Bank (scb.co.th) - Kasikornbank (kasikornbank) Expenses are automatically parsed and stored in the database. SETUP: 1. Configure D1 binding in wrangler.jsonc: d1_databases = [{ binding = "DB", database_name = "expenses", database_id = "your-db-id" }] 2. Deploy the worker: wrangler deploy 3. Set up email routing in Cloudflare dashboard