{ "swagger": "2.0", "info": { "description": "AI Powered Expense Tracker API", "title": "AI Expense Tracker API", "contact": {}, "version": "1.0" }, "host": "ai-expense-tracker-api-production.up.railway.app", "basePath": "/", "paths": { "/api/ai/insights": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get AI generated expense insights", "produces": [ "application/json" ], "tags": [ "AI" ], "summary": "AI Insights", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/auth/login": { "post": { "description": "Login and receive JWT token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Login user", "parameters": [ { "description": "User Login", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/controllers.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/auth/register": { "post": { "description": "Register a new account", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Register a new user", "parameters": [ { "description": "User Registration", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/controllers.RegisterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/budget/": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get budget of logged-in user", "produces": [ "application/json" ], "tags": [ "Budget" ], "summary": "Get Monthly Budget", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Set budget for logged-in user", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Budget" ], "summary": "Set Monthly Budget", "parameters": [ { "description": "Budget Details", "name": "budget", "in": "body", "required": true, "schema": { "$ref": "#/definitions/controllers.BudgetRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/budget-status": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get current budget status", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Budget Status", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/category-summary": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get category-wise expense summary", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Category Summary", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/last7days": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get last 7 days expense summary", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Last 7 Days Summary", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/monthly-summary": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get monthly expense summary", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Monthly Summary", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/summary": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get dashboard summary for logged-in user", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Dashboard Summary", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/dashboard/top-expenses": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get top expenses", "produces": [ "application/json" ], "tags": [ "Dashboard" ], "summary": "Top Expenses", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/expenses/": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Get all expenses of logged-in user", "produces": [ "application/json" ], "tags": [ "Expenses" ], "summary": "Get all expenses", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Add a new expense for the logged-in user", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Expenses" ], "summary": "Create a new expense", "parameters": [ { "description": "Expense Details", "name": "expense", "in": "body", "required": true, "schema": { "$ref": "#/definitions/controllers.ExpenseRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/api/expenses/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Update expense by ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Expenses" ], "summary": "Update an expense", "parameters": [ { "type": "integer", "description": "Expense ID", "name": "id", "in": "path", "required": true }, { "description": "Updated Expense", "name": "expense", "in": "body", "required": true, "schema": { "$ref": "#/definitions/controllers.ExpenseRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Delete expense by ID", "produces": [ "application/json" ], "tags": [ "Expenses" ], "summary": "Delete an expense", "parameters": [ { "type": "integer", "description": "Expense ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } } }, "definitions": { "controllers.BudgetRequest": { "type": "object", "required": [ "monthly_budget" ], "properties": { "monthly_budget": { "type": "number" } } }, "controllers.ExpenseRequest": { "type": "object", "required": [ "amount", "title" ], "properties": { "amount": { "type": "number" }, "category": { "type": "string" }, "description": { "type": "string" }, "title": { "type": "string" } } }, "controllers.LoginRequest": { "type": "object", "required": [ "email", "password" ], "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "controllers.RegisterRequest": { "type": "object", "required": [ "email", "name", "password" ], "properties": { "email": { "type": "string" }, "name": { "type": "string" }, "password": { "type": "string", "minLength": 6 } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }