openapi: 3.0.3 info: title: API version: 1.0.0 components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT paths: /api/login: post: tags: - AUTHENTICATION summary: Login attempt description: Authenticates the user and generates a JWT token for accessing protected API resources. requestBody: required: true content: application/json: schema: type: object required: - email - password properties: email: type: string format: email example: "test@gmail.com" password: type: string format: password example: "123456" responses: '200': description: Token generated successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: Token generated successfully. errors: type: array items: {} example: [] data: type: object properties: token: type: string example: >- eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.abc.def.ghi user: type: object properties: id: type: integer example: 42 name: type: string example: "Usuário Exemplo" email: type: string example: "usuario@exemplo.com" email_verified_at: type: string nullable: true example: null _links: type: object properties: self: type: object properties: href: type: string example: /api/login logout: type: object properties: href: type: string example: /api/logout method: type: string example: POST get: type: object properties: href: type: string example: /api/user/self method: type: string example: GET '401': description: Invalid credentials content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: "Invalid credentials." errors: type: array items: type: string example: - "Email and password do not match" data: type: array items: {} example: [] '422': description: Error validating fields content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: "Error Processing Request" errors: type: array items: type: string example: - "The email field is required." data: type: array items: {} example: [] /api/logout: post: tags: - AUTHENTICATION summary: Expires your current token, ending the session. description: Ends the authenticated user's session, invalidating the current JWT token. security: - bearerAuth: [] responses: '200': description: Logout successful. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: Logout successful. errors: type: array items: {} example: [] data: type: array items: {} example: [] _links: type: object properties: self: type: object properties: href: type: string example: http://127.0.0.1:4001/logout login: type: object properties: href: type: string example: http://127.0.0.1:4001/login user: type: object properties: href: type: string example: http://127.0.0.1:4001/user/self /api/user/self: get: tags: - AUTHENTICATION summary: Retrieves authenticated user's data description: Retrieves user data using the generated token. security: - bearerAuth: [] responses: '200': description: User found successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: "User found successfully." errors: type: array items: {} example: [] data: type: object properties: id: type: integer example: 1 name: type: string example: "Test" email: type: string example: "test@gmail.com" email_verified_at: type: string nullable: true example: null _links: type: object properties: self: type: object properties: href: type: string example: /api/user/self logout: type: object properties: href: type: string example: /api/logout method: type: string example: POST #User /api/v1/user: post: tags: - USER summary: User registration. description: Registers a new user in the system. security: - bearerAuth: [] requestBody: required: true content: application/json: schema: type: object properties: name: type: string example: Test email: type: string example: test02@gmail.com password: type: string example: Abc123! responses: '200': description: User added successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: User added successfully. errors: type: array items: type: string example: [] data: type: object properties: id: type: integer example: 4 user: type: string example: test email: type: string example: test02@gmail.com _links: type: object properties: self: type: object properties: href: type: string example: http://127.0.0.1:4001/user/4 get: type: object properties: href: type: string example: http://127.0.0.1:4001/user/4 method: type: string example: GET update: type: object properties: href: type: string example: http://127.0.0.1:4001/user/4 method: type: string example: PUT delete: type: object properties: href: type: string example: http://127.0.0.1:4001/user/4 method: type: string example: DELETE status: type: object properties: href: type: string example: http://127.0.0.1:4001/user/4 method: type: string example: PATCH '409': description: Duplicate detected. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: Duplicate detected. errors: type: array items: type: string example: - Email already registered. data: type: array items: {} example: [] '422': description: Validation error. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: Error Processing Request errors: type: array items: type: string example: - "The 'name' field is required." data: type: array items: {} example: [] /api/v1/user/{id}: get: tags: - USER summary: Get user. description: Get a user by ID. security: - bearerAuth: [] parameters: - name: id in: path required: true description: User ID to be retrieved. schema: type: integer example: 1 responses: '200': description: User found successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: User found successfully. errors: type: array items: type: string example: [] data: type: object properties: id: type: integer example: 1 name: type: string example: Test email: type: string example: test@gmail.com _links: type: object properties: self: type: object properties: href: type: string example: http://127.0.0.1:4001/user/1 update: type: object properties: href: type: string example: http://127.0.0.1:4001/user/1 method: type: string example: PUT delete: type: object properties: href: type: string example: http://127.0.0.1:4001/user/1 method: type: string example: DELETE status: type: object properties: href: type: string example: http://127.0.0.1:4001/user/1 method: type: string example: PATCH '404': description: User not found. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: User not found. errors: type: array items: type: string example: - ID not identified data: type: array items: {} example: [] delete: tags: - USER summary: Delete user description: Delete a user by their ID. security: - bearerAuth: [] parameters: - name: id in: path required: true description: User ID to be deleted. schema: type: integer minimum: 1 example: 2 responses: "200": description: User deleted successfully. content: application/json: example: status: true message: "User deleted successfully." errors: [] data: [] _links: self: href: "http://127.0.0.1:8000/user/2" "404": description: User not found. content: application/json: example: status: false message: "User not found." errors: - "ID not identified" data: [] "422": description: Validation error. content: application/json: example: status: false message: "Error Processing Request" errors: - "Id must be higher than 0." data: [] put: tags: - USER summary: Update user. description: Update a user's data by their ID. security: - bearerAuth: [] parameters: - name: id in: path required: true description: User ID to be updated. schema: type: integer minimum: 1 example: 3 requestBody: required: true content: application/json: schema: type: object additionalProperties: false properties: name: type: string example: Teste00 email: type: string format: email example: teste00@gmail.com example: name: "Teste00" email: "teste00@gmail.com" responses: "200": description: User updated successfully. content: application/json: example: status: true message: "User updated successfully." errors: [] data: id: "3" name: "teste" email: "teste01@teste.com" _links: self: href: "http://127.0.0.1:8000/user/3" get: href: "http://127.0.0.1:8000/user/3" method: "GET" delete: href: "http://127.0.0.1:8000/user/3" method: "DELETE" status: href: "http://127.0.0.1:8000/user/3" method: "PATCH" "404": description: User not found. content: application/json: example: status: false message: "User not found." errors: - "ID not identified" data: [] "409": description: Data conflict (e.g., email already registered). content: application/json: example: status: false message: "Invalid request." errors: - "Email already registered." data: [] "422": description: Validation error. content: application/json: example: status: false message: "Error Processing Request" errors: - "The 'name' field is required." data: [] #Cache /api/cache: post: tags: - CACHE summary: Store a value in cache. security: - bearerAuth: [] description: Store a value in cache with a specific key and expiration time. requestBody: required: true content: application/json: schema: type: object properties: key: type: string example: sample_key value: type: string example: sample_value ttl: type: integer description: Time in seconds for the cache to expire. example: 3600 responses: '200': description: Cache stored successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: Cache stored successfully. errors: type: array items: {} example: [] data: type: array items: {} example: [] '422': description: Validation error. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: Error Processing Request errors: type: array items: type: string example: - "The 'key' field is required." data: type: array items: {} example: [] /api/cache/{key}: get: tags: - CACHE summary: Retrieve a value from cache. description: Retrieve the value stored in cache for a specific key. security: - bearerAuth: [] parameters: - name: key in: path required: true description: Cache key to be retrieved. schema: type: string example: sample_key responses: '200': description: Cache retrieved successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: Cache retrieved successfully. errors: type: array items: {} example: [] data: type: array items: {} example: key: sample_key value: sample_value '404': description: Cache not found. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: Key not found in cache. errors: type: array items: {} example: [] data: type: array items: {} example: [] delete: tags: - CACHE summary: Remove a value from cache. description: Remove the value stored in cache for a specific key. security: - bearerAuth: [] parameters: - name: key in: path required: true description: Cache key to be removed. schema: type: string example: sample_key responses: '200': description: Cache removed successfully. content: application/json: schema: type: object properties: status: type: boolean example: true message: type: string example: Cache removed successfully. errors: type: array items: {} example: [] data: type: array items: {} example: deleted_count: 1 '404': description: Cache not found. content: application/json: schema: type: object properties: status: type: boolean example: false message: type: string example: Key not found in cache. errors: type: array items: {} example: [] data: type: array items: {} example: []