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: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication operations - name: users description: User management - name: departments description: Department management - name: documents description: Document management (policies & procedures) - name: objectives description: Objective management (KPIs & OKRs) - name: openai description: AI chat operations - name: feed description: Hype Board achievement feed - name: storage description: File upload and object storage endpoints - name: activity-logs description: User activity audit log (admin only) - name: recognitions description: Peer-to-peer employee recognition and leaderboard paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status 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/RegisterBody" responses: "201": description: User created, OTP sent content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/verify-otp: post: operationId: verifyOtp tags: [auth] summary: Verify OTP code requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/VerifyOtpBody" responses: "200": description: OTP verified content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Invalid OTP content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginBody" responses: "200": description: Logged in content: application/json: schema: $ref: "#/components/schemas/UserResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/session: get: operationId: getSession tags: [auth] summary: Get current session responses: "200": description: Current user info content: application/json: schema: $ref: "#/components/schemas/UserResponse" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /users: get: operationId: listUsers tags: [users] summary: List users parameters: - name: departmentId in: query schema: type: integer responses: "200": description: List of users content: application/json: schema: type: array items: $ref: "#/components/schemas/User" post: operationId: createUser tags: [users] summary: Create a new user (admin provisioning) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateUserBody" responses: "201": description: Created user content: application/json: schema: $ref: "#/components/schemas/User" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /users/me/profile: patch: operationId: updateMyProfile tags: [users] summary: Update own avatar and title requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProfileBody" responses: "200": description: Updated user content: application/json: schema: $ref: "#/components/schemas/User" /users/{id}: get: operationId: getUser tags: [users] summary: Get user by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: User details content: application/json: schema: $ref: "#/components/schemas/User" patch: operationId: updateUser tags: [users] summary: Update user parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateUserBody" responses: "200": description: Updated user content: application/json: schema: $ref: "#/components/schemas/User" delete: operationId: deleteUser tags: [users] summary: Delete user parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /departments: get: operationId: listDepartments tags: [departments] summary: List departments responses: "200": description: List of departments content: application/json: schema: type: array items: $ref: "#/components/schemas/Department" post: operationId: createDepartment tags: [departments] summary: Create department requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateDepartmentBody" responses: "201": description: Created department content: application/json: schema: $ref: "#/components/schemas/Department" /departments/{id}: get: operationId: getDepartment tags: [departments] summary: Get department by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Department details content: application/json: schema: $ref: "#/components/schemas/Department" patch: operationId: updateDepartment tags: [departments] summary: Update department parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateDepartmentBody" responses: "200": description: Updated department content: application/json: schema: $ref: "#/components/schemas/Department" delete: operationId: deleteDepartment tags: [departments] summary: Delete department parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /documents: get: operationId: listDocuments tags: [documents] summary: List documents parameters: - name: departmentId in: query schema: type: integer - name: type in: query schema: type: string enum: [POLICY, PROCEDURE, GUIDE, KPI, OKR] - name: status in: query schema: type: string enum: [DRAFT, APPROVED] responses: "200": description: List of documents content: application/json: schema: type: array items: $ref: "#/components/schemas/Document" post: operationId: createDocument tags: [documents] summary: Create document requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateDocumentBody" responses: "201": description: Created document content: application/json: schema: $ref: "#/components/schemas/Document" /documents/{id}: get: operationId: getDocument tags: [documents] summary: Get document by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Document details content: application/json: schema: $ref: "#/components/schemas/Document" patch: operationId: updateDocument tags: [documents] summary: Update document parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateDocumentBody" responses: "200": description: Updated document content: application/json: schema: $ref: "#/components/schemas/Document" delete: operationId: deleteDocument tags: [documents] summary: Delete document parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /documents/{id}/approve: post: operationId: approveDocument tags: [documents] summary: Approve a draft document parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Approved document content: application/json: schema: $ref: "#/components/schemas/Document" /objectives: get: operationId: listObjectives tags: [objectives] summary: List objectives parameters: - name: departmentId in: query schema: type: integer - name: type in: query schema: type: string enum: [KPI, OKR] - name: assignedUserId in: query schema: type: integer - name: available in: query schema: type: boolean description: If true, returns unassigned objectives available to claim in the employee's department responses: "200": description: List of objectives content: application/json: schema: type: array items: $ref: "#/components/schemas/Objective" post: operationId: createObjective tags: [objectives] summary: Create objective requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateObjectiveBody" responses: "201": description: Created objective content: application/json: schema: $ref: "#/components/schemas/Objective" /objectives/{id}: get: operationId: getObjective tags: [objectives] summary: Get objective by ID parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Objective details content: application/json: schema: $ref: "#/components/schemas/Objective" patch: operationId: updateObjective tags: [objectives] summary: Update objective parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateObjectiveBody" responses: "200": description: Updated objective content: application/json: schema: $ref: "#/components/schemas/Objective" delete: operationId: deleteObjective tags: [objectives] summary: Delete objective parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /openai/conversations: get: operationId: listConversations tags: [openai] summary: List user conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/Conversation" post: operationId: createConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateConversationBody" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/Conversation" /openai/conversations/{id}: get: operationId: getConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/ConversationWithMessages" delete: operationId: deleteConversation tags: [openai] summary: Delete conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /openai/conversations/{id}/messages: post: operationId: sendMessage tags: [openai] summary: Send a message to the AI (streaming SSE response) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendMessageBody" responses: "200": description: Streaming SSE response content: text/event-stream: schema: type: string /feed: get: operationId: listFeedPosts tags: [feed] summary: List hype board feed posts parameters: - name: departmentId in: query schema: type: integer responses: "200": description: List of feed posts content: application/json: schema: type: array items: $ref: "#/components/schemas/FeedPost" post: operationId: createFeedPost tags: [feed] summary: Create a hype board post requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateFeedPostBody" responses: "201": description: Created post content: application/json: schema: $ref: "#/components/schemas/FeedPost" /feed/{id}/react: post: operationId: reactToPost tags: [feed] summary: React to a feed post with an emoji parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReactBody" responses: "200": description: Updated post with new reactions content: application/json: schema: $ref: "#/components/schemas/FeedPost" /storage/uploads/request-url: post: operationId: requestUploadUrl tags: [storage] summary: Request a presigned URL for file upload requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UploadUrlRequest" responses: "200": description: Presigned upload URL content: application/json: schema: $ref: "#/components/schemas/UploadUrlResponse" /storage/objects/{objectPath}: get: operationId: getStorageObject tags: [storage] summary: Serve a stored file parameters: - name: objectPath in: path required: true schema: type: string responses: "200": description: File content content: "*/*": schema: type: string format: binary /activity-logs: get: operationId: listActivityLogs tags: [activity-logs] summary: List activity logs (admin only) parameters: - name: action in: query schema: type: string - name: userId in: query schema: type: integer - name: limit in: query schema: type: integer default: 100 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Activity log entries content: application/json: schema: type: array items: $ref: "#/components/schemas/ActivityLog" "403": description: Forbidden /recognitions: get: operationId: listRecognitions tags: [recognitions] summary: List recognitions parameters: - name: toUserId in: query schema: type: integer - name: fromUserId in: query schema: type: integer responses: "200": description: List of recognitions content: application/json: schema: type: array items: $ref: "#/components/schemas/Recognition" post: operationId: createRecognition tags: [recognitions] summary: Give a peer recognition requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateRecognitionBody" responses: "201": description: Created recognition content: application/json: schema: $ref: "#/components/schemas/Recognition" /recognitions/leaderboard: get: operationId: getRecognitionLeaderboard tags: [recognitions] summary: Get top recognised employees responses: "200": description: Leaderboard entries content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: message: type: string required: - message MessageResponse: type: object properties: message: type: string required: - message RegisterBody: type: object properties: username: type: string minLength: 3 email: type: string format: email password: type: string minLength: 6 required: - username - email - password VerifyOtpBody: type: object properties: email: type: string format: email code: type: string required: - email - code LoginBody: type: object properties: email: type: string format: email password: type: string required: - email - password AuthResponse: type: object properties: message: type: string otp: type: string user: $ref: "#/components/schemas/User" required: - message UserRole: type: string enum: [SUPER_ADMIN, MANAGER, EMPLOYEE] User: type: object properties: id: type: integer username: type: string email: type: string role: $ref: "#/components/schemas/UserRole" departmentId: type: integer nullable: true isVerified: type: boolean avatarEmoji: type: string title: type: string currentStreak: type: integer recognitionPoints: type: integer level: type: integer xp: type: integer goldBalance: type: integer birthday: type: string nullable: true workStartDate: type: string nullable: true createdAt: type: string format: date-time required: - id - username - email - role - isVerified - avatarEmoji - title - currentStreak - recognitionPoints - level - xp - goldBalance - createdAt UserResponse: type: object properties: user: $ref: "#/components/schemas/User" required: - user CreateUserBody: type: object properties: username: type: string minLength: 3 email: type: string format: email password: type: string minLength: 6 role: $ref: "#/components/schemas/UserRole" departmentId: type: integer nullable: true required: - username - email - password - role UpdateUserBody: type: object properties: role: $ref: "#/components/schemas/UserRole" departmentId: type: integer nullable: true isVerified: type: boolean UpdateProfileBody: type: object properties: avatarEmoji: type: string title: type: string birthday: type: string nullable: true description: Birthday in MM-DD format workStartDate: type: string nullable: true description: Work start date in YYYY-MM-DD format Department: type: object properties: id: type: integer name: type: string description: type: string nullable: true createdAt: type: string format: date-time required: - id - name - createdAt CreateDepartmentBody: type: object properties: name: type: string minLength: 1 description: type: string required: - name UpdateDepartmentBody: type: object properties: name: type: string description: type: string DocumentType: type: string enum: [POLICY, PROCEDURE, GUIDE, KPI, OKR] DocumentStatus: type: string enum: [DRAFT, APPROVED] Document: type: object properties: id: type: integer title: type: string content: type: string type: $ref: "#/components/schemas/DocumentType" status: $ref: "#/components/schemas/DocumentStatus" departmentId: type: integer authorId: type: integer nullable: true fileUrl: type: string nullable: true fileName: type: string nullable: true goldReward: type: integer quizQuestions: type: array nullable: true items: $ref: "#/components/schemas/QuizQuestion" createdAt: type: string format: date-time required: - id - title - content - type - status - departmentId - goldReward - createdAt CreateDocumentBody: type: object properties: title: type: string minLength: 1 content: type: string type: $ref: "#/components/schemas/DocumentType" departmentId: type: integer status: $ref: "#/components/schemas/DocumentStatus" fileUrl: type: string nullable: true fileName: type: string nullable: true goldReward: type: integer quizQuestions: type: array nullable: true items: $ref: "#/components/schemas/QuizQuestion" required: - title - type - departmentId UpdateDocumentBody: type: object properties: title: type: string content: type: string type: $ref: "#/components/schemas/DocumentType" status: $ref: "#/components/schemas/DocumentStatus" fileUrl: type: string nullable: true fileName: type: string nullable: true goldReward: type: integer quizQuestions: type: array nullable: true items: $ref: "#/components/schemas/QuizQuestion" ObjectiveType: type: string enum: [KPI, OKR] Objective: type: object properties: id: type: integer title: type: string type: $ref: "#/components/schemas/ObjectiveType" targetValue: type: number currentValue: type: number departmentId: type: integer assignedUserId: type: integer nullable: true createdAt: type: string format: date-time required: - id - title - type - targetValue - currentValue - departmentId - createdAt CreateObjectiveBody: type: object properties: title: type: string minLength: 1 type: $ref: "#/components/schemas/ObjectiveType" targetValue: type: number currentValue: type: number departmentId: type: integer assignedUserId: type: integer required: - title - type - targetValue - departmentId UpdateObjectiveBody: type: object properties: title: type: string targetValue: type: number currentValue: type: number assignedUserId: type: integer Conversation: type: object properties: id: type: integer title: type: string userId: type: integer createdAt: type: string format: date-time required: - id - title - userId - createdAt CreateConversationBody: type: object properties: title: type: string required: - title Message: type: object properties: id: type: integer conversationId: type: integer role: type: string enum: [user, assistant] content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt ConversationWithMessages: type: object properties: id: type: integer title: type: string userId: type: integer createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/Message" required: - id - title - userId - createdAt - messages SendMessageBody: type: object properties: content: type: string minLength: 1 required: - content FeedReactions: type: object properties: fire: type: integer party: type: integer rocket: type: integer required: - fire - party - rocket FeedPost: type: object properties: id: type: integer content: type: string authorId: type: integer nullable: true authorName: type: string nullable: true authorAvatar: type: string nullable: true departmentId: type: integer nullable: true isAutomatedAchievement: type: boolean reactions: $ref: "#/components/schemas/FeedReactions" createdAt: type: string format: date-time required: - id - content - isAutomatedAchievement - reactions - createdAt CreateFeedPostBody: type: object properties: content: type: string minLength: 1 required: - content ReactBody: type: object properties: reaction: type: string enum: [fire, party, rocket] required: - reaction UploadUrlRequest: type: object required: [name, size, contentType] properties: name: type: string minLength: 1 size: type: integer minimum: 1 contentType: type: string minLength: 1 UploadUrlResponse: type: object required: [uploadURL, objectPath] properties: uploadURL: type: string format: uri objectPath: type: string metadata: $ref: "#/components/schemas/UploadUrlRequest" ActivityLog: type: object required: [id, action, createdAt] properties: id: type: integer userId: type: integer nullable: true userEmail: type: string nullable: true username: type: string nullable: true action: type: string entityId: type: integer nullable: true entityTitle: type: string nullable: true ipAddress: type: string nullable: true metadata: type: object nullable: true createdAt: type: string format: date-time Recognition: type: object properties: id: type: integer fromUserId: type: integer toUserId: type: integer message: type: string values: type: array items: type: string points: type: integer fromUsername: type: string nullable: true fromAvatar: type: string nullable: true toUsername: type: string nullable: true toAvatar: type: string nullable: true createdAt: type: string format: date-time required: - id - fromUserId - toUserId - message - values - points - createdAt CreateRecognitionBody: type: object properties: toUserId: type: integer message: type: string minLength: 1 values: type: array items: type: string points: type: integer minimum: 1 maximum: 100 required: - toUserId - message LeaderboardEntry: type: object properties: rank: type: integer id: type: integer username: type: string avatarEmoji: type: string title: type: string recognitionPoints: type: integer recognitionsReceived: type: integer departmentId: type: integer nullable: true required: - rank - id - username - avatarEmoji - title - recognitionPoints - recognitionsReceived QuizQuestion: type: object properties: question: type: string options: type: array items: type: string correctIndex: type: integer required: - question - options - correctIndex TransactionType: type: string enum: - EARN - SPEND Transaction: type: object properties: id: type: integer userId: type: integer amount: type: integer type: $ref: "#/components/schemas/TransactionType" description: type: string createdAt: type: string format: date-time required: - id - userId - amount - type - description - createdAt ShopItemCategory: type: string enum: - AVATAR - BORDER - PERK - COSMETIC ShopItem: type: object properties: id: type: integer name: type: string description: type: string cost: type: integer category: $ref: "#/components/schemas/ShopItemCategory" emoji: type: string isAvailable: type: boolean createdAt: type: string format: date-time required: - id - name - description - cost - category - emoji - isAvailable - createdAt