openapi: 3.0.0 info: title: AI Summary Transactions API description: It allows you to summarize transactions using AI. version: 1.0.0 license: name: Apache-2.0 url: "https://www.apache.org/licenses/LICENSE-2.0.html" servers: - url: http://localhost:8080 description: Local server paths: /transactions: get: tags: - transactions summary: Get all transactions description: Retrieve a list of all transactions operationId: getAllTransactions parameters: - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/Offset" - $ref: "#/components/parameters/StartDate" - $ref: "#/components/parameters/EndDate" responses: "200": description: List of transactions retrieved successfully content: application/json: schema: type: object properties: transactions: type: array items: $ref: "#/components/schemas/TransactionApiResponse" total: type: integer description: Total number of transactions limit: type: integer description: Number of transactions per page offset: type: integer description: Number of transactions skipped "500": $ref: "#/components/responses/InternalServerError" post: tags: - transactions summary: Create a new transaction description: Create a new transaction with the provided data operationId: createTransaction requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTransactionRequest" responses: "201": description: Transaction created successfully content: application/json: schema: $ref: "#/components/schemas/TransactionApiResponse" "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalServerError" /transactions/{id}: get: tags: - transactions summary: Get transaction by ID description: Retrieve a specific transaction by its ID operationId: getTransactionById parameters: - $ref: "#/components/parameters/TransactionId" responses: "200": description: Transaction found successfully content: application/json: schema: $ref: "#/components/schemas/TransactionApiResponse" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalServerError" put: tags: - transactions summary: Update transaction by ID description: Update an existing transaction with the provided data operationId: updateTransaction parameters: - $ref: "#/components/parameters/TransactionId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateTransactionRequest" responses: "200": description: Transaction updated successfully content: application/json: schema: $ref: "#/components/schemas/TransactionApiResponse" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalServerError" delete: tags: - transactions summary: Delete transaction by ID description: Delete a specific transaction by its ID operationId: deleteTransaction parameters: - $ref: "#/components/parameters/TransactionId" responses: "204": $ref: "#/components/responses/NoContent" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalServerError" /ai/transactions/summary: post: tags: - AI transactions summary: AI process transaction by generated query description: Process a natural language and generate a query to search for transactions using AI operationId: processAITransactionSummary parameters: - $ref: "#/components/parameters/StartDateRequired" - $ref: "#/components/parameters/EndDateRequired" requestBody: required: true content: application/json: schema: type: object properties: question: type: string description: Natural language question about transactions example: "Quais foram as transações de hoje?" required: - question responses: "200": $ref: "#/components/responses/AIResponse" "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalServerError" /ai/transactions/insights/{scenario}: post: tags: - AI transactions summary: Get AI insights for transactions by scenario description: Generate AI-powered insights for transactions based on a specific scenario within a date range operationId: getAITransactionInsights parameters: - $ref: "#/components/parameters/Scenario" - $ref: "#/components/parameters/StartDateRequired" - $ref: "#/components/parameters/EndDateRequired" responses: "200": $ref: "#/components/responses/AIResponse" "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalServerError" components: parameters: TransactionId: name: id in: path required: true description: Transaction ID schema: type: string example: "123e4567-e89b-12d3-a456-426614174000" StartDate: name: startDate in: query required: false description: Start date for filtering transactions schema: type: string format: date example: "2025-01-01" EndDate: name: endDate in: query required: false description: End date for filtering transactions schema: type: string format: date example: "2025-01-31" StartDateRequired: name: startDate in: query required: true description: Start date for filtering transactions schema: type: string format: date example: "2025-01-01" EndDateRequired: name: endDate in: query required: true description: End date for filtering transactions schema: type: string format: date example: "2025-01-31" Limit: name: limit in: query required: false description: Maximum number of transactions to return schema: type: integer minimum: 1 maximum: 100 default: 20 Offset: name: offset in: query required: false description: Number of transactions to skip schema: type: integer minimum: 0 default: 0 Scenario: name: scenario in: path required: true description: The scenario type for generating insights schema: type: string enum: [Fechada, Aberta, Futura] example: "Fechada" responses: BadRequest: description: Bad request - invalid input data content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" NotFound: description: Resource not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" InternalServerError: description: Internal server error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" NoContent: description: Operation completed successfully AIResponse: description: AI processed query successfully content: application/json: schema: $ref: "#/components/schemas/AIResultResponse" schemas: ErrorResponse: type: object properties: error: type: string example: "Error message" AIResultResponse: type: object properties: result: type: string description: AI processed result example: "Encontrei 5 transações de hoje: compra no supermercado, pagamento de conta, etc." TransactionApiResponse: type: object properties: id: type: string description: Transaction unique identifier example: "123e4567-e89b-12d3-a456-426614174000" date: type: string format: date-time description: Transaction date and time example: "2025-01-08T20:22:32Z" amount: type: number format: decimal description: Transaction amount example: 29.99 description: type: string description: Transaction description example: "Purchase at grocery store" merchant: $ref: "#/components/schemas/MerchantApiResponse" required: - id - date - amount - description - merchant MerchantApiResponse: type: object properties: name: type: string description: Merchant name example: "Walmart" category: type: string description: Merchant category example: "Groceries" required: - name - category CreateTransactionRequest: type: object properties: date: type: string format: date-time description: Transaction date and time example: "2025-01-08T20:22:32Z" amount: type: number format: decimal description: Transaction amount example: 29.99 description: type: string description: Transaction description example: "Purchase at grocery store" merchant: $ref: "#/components/schemas/MerchantApiResponse" required: - date - amount - description - merchant UpdateTransactionRequest: type: object properties: date: type: string format: date-time description: Transaction date and time example: "2025-01-08T20:22:32Z" amount: type: number format: decimal description: Transaction amount example: 29.99 description: type: string description: Transaction description example: "Purchase at grocery store" merchant: $ref: "#/components/schemas/MerchantApiResponse" required: - date - amount - description - merchant