openapi: 3.0.0 info: version: "1.0.0" title: "Account service API" description: Account services servers: - url: http://{{baseUrl}} paths: /get-profile/{id}: get: summary: getting bunch user profile parameters: - in: path name: id required: true schema: type: integer description: Users ID example: 1-2-3-4-5 responses: "200": description: requested user profile exist content: application/json: schema: type: object example: id: 1 name: v1 email: v1@gmail.com role: student student_id_number: 123 "400": description: requested user profile does not exist content: application/json: schema: type: object example: id: 2 status: user not found /api/auth/register: post: summary: create new account requestBody: required: true content: application/json: schema: type: object properties: name: type: string email: type: string password: type: string password_confirmation: type: string required: - name - email - password - password_confirmation responses: "200": description: User created successfully content: application/json: schema: type: object example: status: 200 user successfully created email_to: user@email.com link: automatic generated link to verify email "400": description: Invalid input data content: application/json: schema: type: object example: status: 500 service unavailable validation: invalid input /api/auth/verify_email: post: summary: to verify email after opening verify link requestBody: required: true content: application/json: schema: type: object properties: JWT_token: type: string required: - JWT_token responses: "200": description: email verified content: application/json: schema: type: object example: status: email verified "400": description: invalid content: application/json: schema: type: object example: status: invalid /api/auth/login: post: summary: login to user account requestBody: required: true content: application/json: schema: type: object properties: email: type: string password: type: string required: - email - password responses: "200": description: user logged in content: application/json: schema: type: object example: access_token: JWT TOKEN token_type: bearer expires_in: 3600 "400": description: wrong username or password content: application/json: schema: type: object example: status: incorrect username or password validation: invalid input /api/auth/profile: post: summary: update user profile based on filled field requestBody: required: true content: application/json: schema: type: object properties: JWT_token: type: string password: type: string student_id_number: type: string email: type: string example: new_email@mail.com new_name: type: string new_password: type: string new_password_confirmation: type: string required: - JWT_token - password responses: "200": description: profile updated content: application/json: schema: type: object example: nim update: Success name update: Success password update: Success email update: Success email_to: newemail@mail.com verify_token: random token generated "400": description: wrong token content: application/json: schema: type: object example: status: incorrect password/ nothing has changed validation: invalid input /api/auth/forgot-password: post: summary: send link to user's email to reset password requestBody: required: true content: application/json: schema: type: object properties: email: type: string required: - email responses: "200": description: email found on database content: application/json: schema: type: object example: status: reset token has been sent email_to: email@mail.com link: automatic generated link to reset pass "400": description: email not found on database content: application/json: schema: type: object example: status: email doesnt exist validation: invalid input /api/auth/reset-password: post: summary: to reset password after opening reset link requestBody: required: true content: application/json: schema: type: object properties: JWT_token: type: string new_password: type: string new_password_confirmation: type: string required: - JWT_token - new_password - new_password_confirmation responses: "200": description: successfully changed password content: application/json: schema: type: object example: status: password changed "400": description: incorrect input content: application/json: schema: type: object example: status: incorrect input validation: invalid input /api/auth/me: post: summary: user profile details (already logged in) requestBody: required: true content: application/json: schema: type: object properties: JWT_token: type: string required: - JWT_token responses: "200": description: user logged in content: application/json: schema: type: object example: id: 1 name": "v1" email": "v1@gmail.com" role": "student" "400": description: invalid JWT token content: application/json: schema: type: object example: status: exception /api/auth/logout: post: summary: to logout (logged in user) requestBody: required: true content: application/json: schema: type: object properties: JWT_token: type: string required: - JWT_token responses: "200": description: logout success content: application/json: schema: type: object example: status: successfully logged out "400": description: invalid JWT token content: application/json: schema: type: object example: status: exception /api/auth/delete-account/{id}: delete: summary: soft delete selected user id parameters: - in: path name: id required: true schema: type: integer description: User ID example: 1 responses: "200": description: deleted user account content: application/json: schema: type: object example: status: user successfully deleted "400": description: user not found content: application/json: schema: type: object example: status: user not found