openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Tumakuru District Development Analytics API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/register: post: operationId: register tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserRegister" responses: "201": description: Registered successfully content: application/json: schema: $ref: "#/components/schemas/TokenResponse" "400": description: Email or username already taken /auth/login: post: operationId: login tags: [auth] summary: Login with username and password requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserLogin" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/TokenResponse" "401": description: Invalid credentials /auth/me: get: operationId: getMe tags: [auth] summary: Get current authenticated user security: - bearerAuth: [] responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/User" "401": description: Unauthorized components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: HealthStatus: type: object properties: status: type: string required: - status UserRegister: type: object required: [email, username, password] properties: email: type: string username: type: string full_name: type: ["string", "null"] password: type: string minLength: 6 UserLogin: type: object required: [username, password] properties: username: type: string password: type: string User: type: object required: [id, email, username, is_active, role, created_at] properties: id: type: integer email: type: string username: type: string full_name: type: ["string", "null"] is_active: type: boolean role: type: string created_at: type: string format: date-time TokenResponse: type: object required: [access_token, token_type, user] properties: access_token: type: string token_type: type: string user: $ref: "#/components/schemas/User"