quantix-mcp 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/.github/agents/copilot-instructions.md +32 -0
  3. package/.github/agents/speckit.analyze.agent.md +184 -0
  4. package/.github/agents/speckit.checklist.agent.md +294 -0
  5. package/.github/agents/speckit.clarify.agent.md +181 -0
  6. package/.github/agents/speckit.constitution.agent.md +82 -0
  7. package/.github/agents/speckit.implement.agent.md +135 -0
  8. package/.github/agents/speckit.plan.agent.md +89 -0
  9. package/.github/agents/speckit.specify.agent.md +258 -0
  10. package/.github/agents/speckit.tasks.agent.md +137 -0
  11. package/.github/agents/speckit.taskstoissues.agent.md +30 -0
  12. package/.github/copilot-instructions.md +17 -0
  13. package/.github/prompts/speckit.analyze.prompt.md +3 -0
  14. package/.github/prompts/speckit.checklist.prompt.md +3 -0
  15. package/.github/prompts/speckit.clarify.prompt.md +3 -0
  16. package/.github/prompts/speckit.constitution.prompt.md +3 -0
  17. package/.github/prompts/speckit.implement.prompt.md +3 -0
  18. package/.github/prompts/speckit.plan.prompt.md +3 -0
  19. package/.github/prompts/speckit.specify.prompt.md +3 -0
  20. package/.github/prompts/speckit.tasks.prompt.md +3 -0
  21. package/.github/prompts/speckit.taskstoissues.prompt.md +3 -0
  22. package/.github/workflows/publish.yaml +28 -0
  23. package/.opencode/command/speckit.analyze.md +184 -0
  24. package/.opencode/command/speckit.checklist.md +294 -0
  25. package/.opencode/command/speckit.clarify.md +181 -0
  26. package/.opencode/command/speckit.constitution.md +84 -0
  27. package/.opencode/command/speckit.implement.md +135 -0
  28. package/.opencode/command/speckit.plan.md +89 -0
  29. package/.opencode/command/speckit.specify.md +258 -0
  30. package/.opencode/command/speckit.tasks.md +137 -0
  31. package/.opencode/command/speckit.taskstoissues.md +30 -0
  32. package/.specify/memory/constitution.md +58 -0
  33. package/.specify/scripts/powershell/check-prerequisites.ps1 +148 -0
  34. package/.specify/scripts/powershell/common.ps1 +137 -0
  35. package/.specify/scripts/powershell/create-new-feature.ps1 +283 -0
  36. package/.specify/scripts/powershell/setup-plan.ps1 +61 -0
  37. package/.specify/scripts/powershell/update-agent-context.ps1 +448 -0
  38. package/.specify/templates/agent-file-template.md +28 -0
  39. package/.specify/templates/checklist-template.md +40 -0
  40. package/.specify/templates/constitution-template.md +50 -0
  41. package/.specify/templates/plan-template.md +104 -0
  42. package/.specify/templates/spec-template.md +115 -0
  43. package/.specify/templates/tasks-template.md +251 -0
  44. package/.vscode/launch.json +14 -0
  45. package/.vscode/settings.json +14 -0
  46. package/.vscode/tasks.json +15 -0
  47. package/CLAUDE.md +64 -0
  48. package/README.md +176 -0
  49. package/dist/config.d.ts +8 -0
  50. package/dist/config.d.ts.map +1 -0
  51. package/dist/config.js +31 -0
  52. package/dist/config.js.map +1 -0
  53. package/dist/index.d.ts +4 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +41 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/services/apiClient.d.ts +14 -0
  58. package/dist/services/apiClient.d.ts.map +1 -0
  59. package/dist/services/apiClient.js +41 -0
  60. package/dist/services/apiClient.js.map +1 -0
  61. package/dist/tools/accounts.d.ts +3 -0
  62. package/dist/tools/accounts.d.ts.map +1 -0
  63. package/dist/tools/accounts.js +77 -0
  64. package/dist/tools/accounts.js.map +1 -0
  65. package/dist/tools/categories.d.ts +3 -0
  66. package/dist/tools/categories.d.ts.map +1 -0
  67. package/dist/tools/categories.js +57 -0
  68. package/dist/tools/categories.js.map +1 -0
  69. package/dist/tools/credit-cards.d.ts +3 -0
  70. package/dist/tools/credit-cards.d.ts.map +1 -0
  71. package/dist/tools/credit-cards.js +93 -0
  72. package/dist/tools/credit-cards.js.map +1 -0
  73. package/dist/tools/data.d.ts +3 -0
  74. package/dist/tools/data.d.ts.map +1 -0
  75. package/dist/tools/data.js +27 -0
  76. package/dist/tools/data.js.map +1 -0
  77. package/dist/tools/settings.d.ts +3 -0
  78. package/dist/tools/settings.d.ts.map +1 -0
  79. package/dist/tools/settings.js +37 -0
  80. package/dist/tools/settings.js.map +1 -0
  81. package/dist/tools/summary.d.ts +3 -0
  82. package/dist/tools/summary.d.ts.map +1 -0
  83. package/dist/tools/summary.js +23 -0
  84. package/dist/tools/summary.js.map +1 -0
  85. package/dist/tools/transactions.d.ts +3 -0
  86. package/dist/tools/transactions.d.ts.map +1 -0
  87. package/dist/tools/transactions.js +102 -0
  88. package/dist/tools/transactions.js.map +1 -0
  89. package/dist/types/schemas.d.ts +330 -0
  90. package/dist/types/schemas.d.ts.map +1 -0
  91. package/dist/types/schemas.js +206 -0
  92. package/dist/types/schemas.js.map +1 -0
  93. package/openapi.yaml +1786 -0
  94. package/package.json +41 -0
  95. package/specs/001-mcp-api-integration/checklists/requirements.md +34 -0
  96. package/specs/001-mcp-api-integration/contracts/openapi.yaml +636 -0
  97. package/specs/001-mcp-api-integration/data-model.md +106 -0
  98. package/specs/001-mcp-api-integration/plan.md +73 -0
  99. package/specs/001-mcp-api-integration/quickstart.md +74 -0
  100. package/specs/001-mcp-api-integration/research.md +58 -0
  101. package/specs/001-mcp-api-integration/spec.md +119 -0
  102. package/specs/001-mcp-api-integration/tasks.md +64 -0
  103. package/src/config.ts +36 -0
  104. package/src/index.ts +47 -0
  105. package/src/services/apiClient.ts +49 -0
  106. package/src/tools/accounts.ts +111 -0
  107. package/src/tools/categories.ts +81 -0
  108. package/src/tools/credit-cards.ts +132 -0
  109. package/src/tools/data.ts +36 -0
  110. package/src/tools/settings.ts +51 -0
  111. package/src/tools/summary.ts +24 -0
  112. package/src/tools/transactions.ts +128 -0
  113. package/src/types/schemas.ts +230 -0
  114. package/tests/benchmark.test.d.ts +2 -0
  115. package/tests/benchmark.test.d.ts.map +1 -0
  116. package/tests/benchmark.test.js +33 -0
  117. package/tests/benchmark.test.js.map +1 -0
  118. package/tests/benchmark.test.ts +38 -0
  119. package/tests/server.test.d.ts +2 -0
  120. package/tests/server.test.d.ts.map +1 -0
  121. package/tests/server.test.js +13 -0
  122. package/tests/server.test.js.map +1 -0
  123. package/tests/server.test.ts +14 -0
  124. package/tests/setup.d.ts +4 -0
  125. package/tests/setup.d.ts.map +1 -0
  126. package/tests/setup.js +17 -0
  127. package/tests/setup.js.map +1 -0
  128. package/tests/setup.ts +20 -0
  129. package/tests/tools/accounts.test.ts +118 -0
  130. package/tests/tools/categories.test.d.ts +2 -0
  131. package/tests/tools/categories.test.d.ts.map +1 -0
  132. package/tests/tools/categories.test.js +63 -0
  133. package/tests/tools/categories.test.js.map +1 -0
  134. package/tests/tools/categories.test.ts +78 -0
  135. package/tests/tools/credit-cards.test.d.ts +2 -0
  136. package/tests/tools/credit-cards.test.d.ts.map +1 -0
  137. package/tests/tools/credit-cards.test.js +71 -0
  138. package/tests/tools/credit-cards.test.js.map +1 -0
  139. package/tests/tools/credit-cards.test.ts +89 -0
  140. package/tests/tools/summary.test.d.ts +2 -0
  141. package/tests/tools/summary.test.d.ts.map +1 -0
  142. package/tests/tools/summary.test.js +36 -0
  143. package/tests/tools/summary.test.js.map +1 -0
  144. package/tests/tools/summary.test.ts +42 -0
  145. package/tests/tools/transactions.test.d.ts +2 -0
  146. package/tests/tools/transactions.test.d.ts.map +1 -0
  147. package/tests/tools/transactions.test.js +67 -0
  148. package/tests/tools/transactions.test.js.map +1 -0
  149. package/tests/tools/transactions.test.ts +82 -0
  150. package/tsconfig.json +52 -0
  151. package/vitest.config.d.ts +3 -0
  152. package/vitest.config.d.ts.map +1 -0
  153. package/vitest.config.js +14 -0
  154. package/vitest.config.js.map +1 -0
  155. package/vitest.config.ts +14 -0
package/openapi.yaml ADDED
@@ -0,0 +1,1786 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Quantix Personal Finance Manager API
4
+ description: API for managing personal finances including transactions, credit cards, categories, and recurring payments
5
+ version: 1.0.0
6
+ contact:
7
+ name: Quantix Support
8
+ email: support@quantix.example.com
9
+
10
+ servers:
11
+ - url: https://api.quantix.example.com
12
+ description: Production server
13
+ - url: https://staging.quantix.example.com
14
+ description: Staging server
15
+
16
+ components:
17
+ securitySchemes:
18
+ ApiKeyAuth:
19
+ type: apiKey
20
+ in: header
21
+ name: API-KEY
22
+ description: API key for authentication, configured via QUANTIX_API_KEY environment variable
23
+
24
+ schemas:
25
+ Category:
26
+ type: object
27
+ required:
28
+ - name
29
+ - type
30
+ properties:
31
+ id:
32
+ type: string
33
+ description: Unique identifier for the category
34
+ example: "cat_123456789"
35
+ name:
36
+ type: string
37
+ description: Name of the category
38
+ example: "Groceries"
39
+ type:
40
+ type: string
41
+ enum: [INCOME, EXPENSE]
42
+ description: Type of the category
43
+ example: "EXPENSE"
44
+ color:
45
+ type: string
46
+ nullable: true
47
+ description: Color for the category in hexadecimal format
48
+ example: "#FF5733"
49
+ createdAt:
50
+ type: string
51
+ format: date-time
52
+ description: Timestamp when the category was created
53
+ example: "2026-01-30T10:00:00Z"
54
+
55
+ Transaction:
56
+ type: object
57
+ required:
58
+ - type
59
+ - name
60
+ - amount
61
+ - date
62
+ properties:
63
+ id:
64
+ type: string
65
+ description: Unique identifier for the transaction
66
+ example: "txn_123456789"
67
+ type:
68
+ type: string
69
+ enum: [INCOME, EXPENSE]
70
+ description: Type of the transaction
71
+ example: "EXPENSE"
72
+ name:
73
+ type: string
74
+ description: Description of the transaction
75
+ example: "Weekly groceries"
76
+ amount:
77
+ type: number
78
+ format: float
79
+ minimum: 0
80
+ description: Amount of the transaction
81
+ example: 125.75
82
+ date:
83
+ type: string
84
+ format: date
85
+ description: Date of the transaction
86
+ example: "2026-01-30"
87
+ purchaseDate:
88
+ type: string
89
+ format: date
90
+ description: Actual purchase date (credit card only, optional)
91
+ example: "2026-02-10"
92
+ nullable: true
93
+ categoryId:
94
+ type: string
95
+ description: ID of the associated category
96
+ example: "cat_123456789"
97
+ category:
98
+ $ref: '#/components/schemas/Category'
99
+ description: Associated category object
100
+ paymentMethod:
101
+ type: string
102
+ enum: [CASH, PIX, DEBIT, CREDIT]
103
+ description: Method of payment
104
+ example: "CREDIT"
105
+ creditCardId:
106
+ type: string
107
+ description: ID of the associated credit card (required if paymentMethod is CREDIT)
108
+ example: "cc_123456789"
109
+ creditCard:
110
+ $ref: '#/components/schemas/CreditCard'
111
+ description: Associated credit card object
112
+ installmentGroupId:
113
+ type: string
114
+ description: ID to group installment transactions
115
+ example: "ig_123456789"
116
+ installmentNumber:
117
+ type: integer
118
+ minimum: 1
119
+ description: Current installment number in a series
120
+ example: 2
121
+ installmentTotal:
122
+ type: integer
123
+ minimum: 1
124
+ description: Total number of installments in the series
125
+ example: 5
126
+ recurrenceRuleId:
127
+ type: string
128
+ description: ID of the associated recurrence rule
129
+ example: "rr_123456789"
130
+ accountId:
131
+ type: string
132
+ description: ID of the associated account (required if paymentMethod is not CREDIT)
133
+ example: "acc_123456789"
134
+ account:
135
+ $ref: '#/components/schemas/Account'
136
+ description: Associated account object
137
+ paid:
138
+ type: boolean
139
+ default: false
140
+ description: Whether the transaction has been paid/received
141
+ example: true
142
+ createdAt:
143
+ type: string
144
+ format: date-time
145
+ description: Timestamp when the transaction was created
146
+ example: "2026-01-30T10:00:00Z"
147
+
148
+ CreditCard:
149
+ type: object
150
+ required:
151
+ - name
152
+ - limitAmount
153
+ - closingDay
154
+ - dueDay
155
+ properties:
156
+ id:
157
+ type: string
158
+ description: Unique identifier for the credit card
159
+ example: "cc_123456789"
160
+ name:
161
+ type: string
162
+ description: Name of the credit card
163
+ example: "Nubank Platinum"
164
+ brand:
165
+ type: string
166
+ description: Brand of the credit card
167
+ example: "Visa"
168
+ limitAmount:
169
+ type: number
170
+ format: float
171
+ minimum: 0
172
+ description: Credit limit of the card
173
+ example: 5000.00
174
+ closingDay:
175
+ type: integer
176
+ minimum: 1
177
+ maximum: 31
178
+ description: Day of the month when the billing cycle closes
179
+ example: 15
180
+ dueDay:
181
+ type: integer
182
+ minimum: 1
183
+ maximum: 31
184
+ description: Day of the month when the bill is due
185
+ example: 22
186
+ availableLimit:
187
+ type: number
188
+ format: float
189
+ description: Available credit limit (limitAmount minus all pending unpaid expenses)
190
+ example: 3200.00
191
+ createdAt:
192
+ type: string
193
+ format: date-time
194
+ description: Timestamp when the credit card was added
195
+ example: "2026-01-30T10:00:00Z"
196
+
197
+ RecurrenceRule:
198
+ type: object
199
+ required:
200
+ - frequency
201
+ properties:
202
+ id:
203
+ type: string
204
+ description: Unique identifier for the recurrence rule
205
+ example: "rr_123456789"
206
+ frequency:
207
+ type: string
208
+ enum: [MONTHLY, WEEKLY, YEARLY]
209
+ description: Frequency of recurrence
210
+ example: "MONTHLY"
211
+ interval:
212
+ type: integer
213
+ minimum: 1
214
+ default: 1
215
+ description: Interval multiplier for the frequency
216
+ example: 1
217
+ endDate:
218
+ type: string
219
+ format: date
220
+ description: Date when the recurrence should end (mutually exclusive with occurrences)
221
+ example: "2026-12-31"
222
+ occurrences:
223
+ type: integer
224
+ minimum: 2
225
+ description: Number of occurrences (mutually exclusive with endDate). When set, transaction names will be formatted as "Name (N/total)"
226
+ example: 12
227
+ createdAt:
228
+ type: string
229
+ format: date-time
230
+ description: Timestamp when the recurrence rule was created
231
+ example: "2026-01-30T10:00:00Z"
232
+
233
+ Statement:
234
+ type: object
235
+ properties:
236
+ cardId:
237
+ type: string
238
+ description: ID of the credit card
239
+ example: "cc_123456789"
240
+ periodStart:
241
+ type: string
242
+ format: date
243
+ description: Start date of the billing period
244
+ example: "2026-02-16"
245
+ periodEnd:
246
+ type: string
247
+ format: date
248
+ description: End date of the billing period
249
+ example: "2026-03-15"
250
+ dueDate:
251
+ type: string
252
+ format: date
253
+ description: Due date of the statement
254
+ example: "2026-03-22"
255
+ transactions:
256
+ type: array
257
+ items:
258
+ $ref: '#/components/schemas/Transaction'
259
+ description: List of transactions in the statement period
260
+ total:
261
+ type: number
262
+ format: float
263
+ description: Total amount of the statement
264
+ example: 3450.00
265
+ availableLimit:
266
+ type: number
267
+ format: float
268
+ description: Available credit limit
269
+ example: 1550.00
270
+
271
+ StatementStatus:
272
+ type: object
273
+ properties:
274
+ cardId:
275
+ type: string
276
+ description: ID of the credit card
277
+ example: "cc_123456789"
278
+ month:
279
+ type: string
280
+ description: Month for the statement (YYYY-MM format)
281
+ example: "2026-03"
282
+ isPaid:
283
+ type: boolean
284
+ description: Whether all transactions in the statement are paid
285
+ example: true
286
+
287
+ Account:
288
+ type: object
289
+ required:
290
+ - name
291
+ - type
292
+ - initialBalance
293
+ properties:
294
+ id:
295
+ type: string
296
+ description: Unique identifier for the account
297
+ example: "acc_123456789"
298
+ name:
299
+ type: string
300
+ description: Name of the account
301
+ example: "Itaú Checking Account"
302
+ type:
303
+ type: string
304
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
305
+ description: Type of account
306
+ example: "BANK_ACCOUNT"
307
+ initialBalance:
308
+ type: number
309
+ format: float
310
+ description: Initial balance when the account was created
311
+ example: 1000.00
312
+ currentBalance:
313
+ type: number
314
+ format: float
315
+ description: Current balance of the account
316
+ example: 850.00
317
+ createdAt:
318
+ type: string
319
+ format: date-time
320
+ description: Timestamp when the account was created
321
+ example: "2026-02-11T12:00:00Z"
322
+ updatedAt:
323
+ type: string
324
+ format: date-time
325
+ description: Timestamp when the account was last updated
326
+ example: "2026-02-11T15:30:00Z"
327
+
328
+ AccountBalance:
329
+ type: object
330
+ properties:
331
+ accountId:
332
+ type: string
333
+ description: ID of the account
334
+ example: "acc_123456789"
335
+ currentBalance:
336
+ type: number
337
+ format: float
338
+ description: Current balance of the account
339
+ example: 850.00
340
+ calculatedAt:
341
+ type: string
342
+ format: date-time
343
+ description: Timestamp when the balance was calculated
344
+ example: "2026-02-11T16:00:00Z"
345
+
346
+
347
+ CategoryBreakdown:
348
+ type: object
349
+ properties:
350
+ categoryId:
351
+ type: string
352
+ nullable: true
353
+ description: Category ID (null if uncategorized)
354
+ example: "cat-123"
355
+ categoryName:
356
+ type: string
357
+ nullable: true
358
+ description: Category name (null if uncategorized)
359
+ example: "Housing"
360
+ color:
361
+ type: string
362
+ nullable: true
363
+ description: Category color in hex format
364
+ example: "#ff5733"
365
+ total:
366
+ type: number
367
+ format: float
368
+ description: Total amount for this category
369
+ example: 1500.00
370
+
371
+ Summary:
372
+ type: object
373
+ properties:
374
+ period:
375
+ type: object
376
+ description: The period covered by this summary
377
+ properties:
378
+ month:
379
+ type: string
380
+ description: Month in YYYY-MM format (present when queried by month)
381
+ example: "2026-02"
382
+ startDate:
383
+ type: string
384
+ description: Start date in YYYY-MM-DD format (present when queried by range)
385
+ example: "2026-01-01"
386
+ endDate:
387
+ type: string
388
+ description: End date in YYYY-MM-DD format (present when queried by range)
389
+ example: "2026-03-31"
390
+ income:
391
+ type: number
392
+ format: float
393
+ description: Total income for the period (paid + pending)
394
+ example: 10000.00
395
+ expenses:
396
+ type: number
397
+ format: float
398
+ description: Total expenses for the period (paid + pending)
399
+ example: 4000.00
400
+ pendingIncome:
401
+ type: number
402
+ format: float
403
+ description: Sum of income transactions not yet marked as received
404
+ example: 1000.00
405
+ pendingExpenses:
406
+ type: number
407
+ format: float
408
+ description: Sum of expense transactions not yet marked as paid
409
+ example: 500.00
410
+ balance:
411
+ type: number
412
+ format: float
413
+ description: Net balance (income - expenses)
414
+ example: 6000.00
415
+ creditCardExpenses:
416
+ type: array
417
+ description: Credit card totals for the period
418
+ items:
419
+ type: object
420
+ properties:
421
+ cardId:
422
+ type: string
423
+ description: Credit card ID
424
+ example: "abc-123"
425
+ cardName:
426
+ type: string
427
+ description: Credit card name
428
+ example: "Nubank"
429
+ total:
430
+ type: number
431
+ format: float
432
+ description: Total charged to this card in the period
433
+ example: 2500.00
434
+ dueDate:
435
+ type: string
436
+ format: date
437
+ nullable: true
438
+ description: Statement due date (only present when queried by month)
439
+ example: "2026-03-22"
440
+ isPaid:
441
+ type: boolean
442
+ nullable: true
443
+ description: Whether the statement is fully paid (only present when queried by month)
444
+ example: false
445
+ expensesByCategory:
446
+ type: array
447
+ description: Expense totals grouped by category, sorted by total descending
448
+ items:
449
+ $ref: '#/components/schemas/CategoryBreakdown'
450
+ incomeByCategory:
451
+ type: array
452
+ description: Income totals grouped by category, sorted by total descending
453
+ items:
454
+ $ref: '#/components/schemas/CategoryBreakdown'
455
+ accounts:
456
+ type: array
457
+ description: >
458
+ All accounts with their current balance (initialBalance + paid income - paid expenses).
459
+ Not filtered by period.
460
+ items:
461
+ $ref: '#/components/schemas/AccountSummary'
462
+ totalBalance:
463
+ type: number
464
+ format: float
465
+ description: Sum of all account balances. Not filtered by period.
466
+ example: 8500.00
467
+
468
+ AccountSummary:
469
+ type: object
470
+ properties:
471
+ accountId:
472
+ type: string
473
+ description: Account ID
474
+ example: "acc-123"
475
+ accountName:
476
+ type: string
477
+ description: Account name
478
+ example: "Nubank"
479
+ accountType:
480
+ type: string
481
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
482
+ description: Account type
483
+ example: "BANK_ACCOUNT"
484
+ balance:
485
+ type: number
486
+ format: float
487
+ description: Current balance (initialBalance + paid income - paid expenses)
488
+ example: 2500.00
489
+
490
+ CreateTransactionRequest:
491
+ type: object
492
+ required:
493
+ - type
494
+ - name
495
+ - amount
496
+ - date
497
+ properties:
498
+ type:
499
+ $ref: '#/components/schemas/Transaction/properties/type'
500
+ name:
501
+ $ref: '#/components/schemas/Transaction/properties/name'
502
+ amount:
503
+ $ref: '#/components/schemas/Transaction/properties/amount'
504
+ date:
505
+ type: string
506
+ format: date
507
+ description: |
508
+ Date of the transaction.
509
+ For CREDIT payments, if targetDueMonth is provided, the date will be calculated based on the credit card's due day.
510
+ Otherwise, this date will be used directly.
511
+ example: "2026-01-30"
512
+ categoryId:
513
+ $ref: '#/components/schemas/Transaction/properties/categoryId'
514
+ paymentMethod:
515
+ $ref: '#/components/schemas/Transaction/properties/paymentMethod'
516
+ creditCardId:
517
+ $ref: '#/components/schemas/Transaction/properties/creditCardId'
518
+ installments:
519
+ type: integer
520
+ minimum: 1
521
+ description: Number of installments (optional)
522
+ example: 3
523
+ targetDueMonth:
524
+ type: string
525
+ pattern: "^\\d{4}-\\d{2}$"
526
+ description: |
527
+ Target month for due date in YYYY-MM format (optional).
528
+ When provided for CREDIT payments, the transaction date(s) will be set to the credit card's due day in the specified month.
529
+ For installments, each installment will be scheduled in subsequent months on the due day.
530
+ Example: if credit card due day is 10, and targetDueMonth is "2026-03", the transaction date will be 2026-03-10.
531
+ example: "2026-03"
532
+ accountId:
533
+ type: string
534
+ description: ID of the associated account (required if paymentMethod is not CREDIT)
535
+ example: "acc_123456789"
536
+ recurrence:
537
+ type: object
538
+ properties:
539
+ frequency:
540
+ $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
541
+ interval:
542
+ $ref: '#/components/schemas/RecurrenceRule/properties/interval'
543
+ endDate:
544
+ $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
545
+ occurrences:
546
+ $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
547
+ isPaid:
548
+ type: boolean
549
+ description: Whether the transaction is already paid at creation time (defaults to false)
550
+ example: false
551
+ purchaseDate:
552
+ type: string
553
+ format: date
554
+ description: Actual purchase date (credit card only, optional)
555
+ example: "2026-02-10"
556
+
557
+ UpdateTransactionRequest:
558
+ type: object
559
+ properties:
560
+ type:
561
+ $ref: '#/components/schemas/Transaction/properties/type'
562
+ name:
563
+ $ref: '#/components/schemas/Transaction/properties/name'
564
+ amount:
565
+ $ref: '#/components/schemas/Transaction/properties/amount'
566
+ date:
567
+ type: string
568
+ format: date
569
+ description: |
570
+ Date of the transaction.
571
+ For CREDIT payments, if targetDueMonth is provided, the date will be calculated based on the credit card's due day.
572
+ Otherwise, this date will be used directly.
573
+ example: "2026-01-30"
574
+ categoryId:
575
+ $ref: '#/components/schemas/Transaction/properties/categoryId'
576
+ paymentMethod:
577
+ $ref: '#/components/schemas/Transaction/properties/paymentMethod'
578
+ creditCardId:
579
+ $ref: '#/components/schemas/Transaction/properties/creditCardId'
580
+ targetDueMonth:
581
+ type: string
582
+ pattern: "^\\d{4}-\\d{2}$"
583
+ description: |
584
+ Target month for due date in YYYY-MM format (optional).
585
+ When provided for CREDIT payments, the transaction date will be set to the credit card's due day in the specified month.
586
+ Example: if credit card due day is 10, and targetDueMonth is "2026-03", the transaction date will be 2026-03-10.
587
+ example: "2026-03"
588
+ accountId:
589
+ type: string
590
+ description: ID of the associated account (required if paymentMethod is not CREDIT)
591
+ example: "acc_123456789"
592
+ recurrence:
593
+ type: object
594
+ properties:
595
+ frequency:
596
+ $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
597
+ interval:
598
+ $ref: '#/components/schemas/RecurrenceRule/properties/interval'
599
+ endDate:
600
+ $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
601
+ occurrences:
602
+ $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
603
+
604
+ Settings:
605
+ type: object
606
+ required:
607
+ - userName
608
+ - language
609
+ - currency
610
+ properties:
611
+ userName:
612
+ type: string
613
+ description: Name of the user
614
+ example: "John Doe"
615
+ language:
616
+ type: string
617
+ enum: [pt-BR, en-US]
618
+ description: Preferred language
619
+ example: "pt-BR"
620
+ currency:
621
+ type: string
622
+ enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
623
+ description: Default currency
624
+ example: "BRL"
625
+ createdAt:
626
+ type: string
627
+ format: date-time
628
+ description: Timestamp when settings were created
629
+ example: "2026-01-30T10:00:00Z"
630
+ updatedAt:
631
+ type: string
632
+ format: date-time
633
+ description: Timestamp when settings were last updated
634
+ example: "2026-01-30T10:00:00Z"
635
+
636
+ responses:
637
+ UnauthorizedError:
638
+ description: API key is missing or invalid
639
+ content:
640
+ application/json:
641
+ schema:
642
+ type: object
643
+ properties:
644
+ statusCode:
645
+ type: integer
646
+ example: 401
647
+ error:
648
+ type: string
649
+ example: "Unauthorized"
650
+ message:
651
+ type: string
652
+ example: "Invalid API key"
653
+
654
+ security:
655
+ - ApiKeyAuth: []
656
+
657
+ paths:
658
+ /categories:
659
+ post:
660
+ summary: Create a new category
661
+ requestBody:
662
+ required: true
663
+ content:
664
+ application/json:
665
+ schema:
666
+ type: object
667
+ required:
668
+ - name
669
+ - type
670
+ properties:
671
+ name:
672
+ type: string
673
+ example: "Groceries"
674
+ type:
675
+ type: string
676
+ enum: [INCOME, EXPENSE]
677
+ example: "EXPENSE"
678
+ color:
679
+ type: string
680
+ nullable: true
681
+ pattern: "^#[0-9A-Fa-f]{6}$"
682
+ description: Color in hexadecimal format
683
+ example: "#FF5733"
684
+ responses:
685
+ '201':
686
+ description: Category created successfully
687
+ content:
688
+ application/json:
689
+ schema:
690
+ $ref: '#/components/schemas/Category'
691
+ '400':
692
+ description: Invalid input
693
+ '401':
694
+ $ref: '#/components/responses/UnauthorizedError'
695
+
696
+ get:
697
+ summary: Get all categories
698
+ responses:
699
+ '200':
700
+ description: List of categories
701
+ content:
702
+ application/json:
703
+ schema:
704
+ type: array
705
+ items:
706
+ $ref: '#/components/schemas/Category'
707
+ '401':
708
+ $ref: '#/components/responses/UnauthorizedError'
709
+
710
+ /categories/{id}:
711
+ get:
712
+ summary: Get a category by ID
713
+ parameters:
714
+ - name: id
715
+ in: path
716
+ required: true
717
+ schema:
718
+ type: string
719
+ description: Category ID
720
+ responses:
721
+ '200':
722
+ description: Category found
723
+ content:
724
+ application/json:
725
+ schema:
726
+ $ref: '#/components/schemas/Category'
727
+ '401':
728
+ $ref: '#/components/responses/UnauthorizedError'
729
+ '404':
730
+ description: Category not found
731
+
732
+ patch:
733
+ summary: Update a category
734
+ parameters:
735
+ - name: id
736
+ in: path
737
+ required: true
738
+ schema:
739
+ type: string
740
+ description: Category ID
741
+ requestBody:
742
+ required: true
743
+ content:
744
+ application/json:
745
+ schema:
746
+ type: object
747
+ properties:
748
+ name:
749
+ type: string
750
+ example: "Groceries"
751
+ color:
752
+ type: string
753
+ nullable: true
754
+ pattern: "^#[0-9A-Fa-f]{6}$"
755
+ description: Color in hexadecimal format
756
+ example: "#FF5733"
757
+ responses:
758
+ '200':
759
+ description: Category updated successfully
760
+ content:
761
+ application/json:
762
+ schema:
763
+ $ref: '#/components/schemas/Category'
764
+ '400':
765
+ description: Invalid input
766
+ '401':
767
+ $ref: '#/components/responses/UnauthorizedError'
768
+ '404':
769
+ description: Category not found
770
+
771
+ delete:
772
+ summary: Delete a category
773
+ parameters:
774
+ - name: id
775
+ in: path
776
+ required: true
777
+ schema:
778
+ type: string
779
+ description: Category ID
780
+ responses:
781
+ '200':
782
+ description: Category deleted successfully
783
+ '401':
784
+ $ref: '#/components/responses/UnauthorizedError'
785
+ '404':
786
+ description: Category not found
787
+
788
+ /credit-cards:
789
+ post:
790
+ summary: Create a new credit card
791
+ requestBody:
792
+ required: true
793
+ content:
794
+ application/json:
795
+ schema:
796
+ type: object
797
+ required:
798
+ - name
799
+ - limitAmount
800
+ - closingDay
801
+ - dueDay
802
+ properties:
803
+ name:
804
+ type: string
805
+ example: "Nubank Platinum"
806
+ brand:
807
+ type: string
808
+ example: "Visa"
809
+ limitAmount:
810
+ type: number
811
+ format: float
812
+ example: 5000.00
813
+ closingDay:
814
+ type: integer
815
+ minimum: 1
816
+ maximum: 31
817
+ example: 15
818
+ dueDay:
819
+ type: integer
820
+ minimum: 1
821
+ maximum: 31
822
+ example: 22
823
+ responses:
824
+ '201':
825
+ description: Credit card created successfully
826
+ content:
827
+ application/json:
828
+ schema:
829
+ $ref: '#/components/schemas/CreditCard'
830
+ '400':
831
+ description: Invalid input
832
+ '401':
833
+ $ref: '#/components/responses/UnauthorizedError'
834
+
835
+ get:
836
+ summary: Get all credit cards
837
+ responses:
838
+ '200':
839
+ description: List of credit cards
840
+ content:
841
+ application/json:
842
+ schema:
843
+ type: array
844
+ items:
845
+ $ref: '#/components/schemas/CreditCard'
846
+ '401':
847
+ $ref: '#/components/responses/UnauthorizedError'
848
+
849
+ /credit-cards/{id}:
850
+ get:
851
+ summary: Get a credit card by ID
852
+ parameters:
853
+ - name: id
854
+ in: path
855
+ required: true
856
+ schema:
857
+ type: string
858
+ description: Credit card ID
859
+ responses:
860
+ '200':
861
+ description: Credit card found
862
+ content:
863
+ application/json:
864
+ schema:
865
+ $ref: '#/components/schemas/CreditCard'
866
+ '401':
867
+ $ref: '#/components/responses/UnauthorizedError'
868
+ '404':
869
+ description: Credit card not found
870
+
871
+ patch:
872
+ summary: Update a credit card
873
+ parameters:
874
+ - name: id
875
+ in: path
876
+ required: true
877
+ schema:
878
+ type: string
879
+ description: Credit card ID
880
+ requestBody:
881
+ required: true
882
+ content:
883
+ application/json:
884
+ schema:
885
+ type: object
886
+ properties:
887
+ name:
888
+ type: string
889
+ example: "Nubank Platinum"
890
+ brand:
891
+ type: string
892
+ example: "Visa"
893
+ limitAmount:
894
+ type: number
895
+ format: float
896
+ example: 5000.00
897
+ closingDay:
898
+ type: integer
899
+ minimum: 1
900
+ maximum: 31
901
+ example: 15
902
+ dueDay:
903
+ type: integer
904
+ minimum: 1
905
+ maximum: 31
906
+ example: 22
907
+ responses:
908
+ '200':
909
+ description: Credit card updated successfully
910
+ content:
911
+ application/json:
912
+ schema:
913
+ $ref: '#/components/schemas/CreditCard'
914
+ '400':
915
+ description: Invalid input
916
+ '401':
917
+ $ref: '#/components/responses/UnauthorizedError'
918
+ '404':
919
+ description: Credit card not found
920
+
921
+ delete:
922
+ summary: Delete a credit card
923
+ parameters:
924
+ - name: id
925
+ in: path
926
+ required: true
927
+ schema:
928
+ type: string
929
+ description: Credit card ID
930
+ responses:
931
+ '200':
932
+ description: Credit card deleted successfully
933
+ '400':
934
+ description: Cannot delete credit card with associated transactions
935
+ '401':
936
+ $ref: '#/components/responses/UnauthorizedError'
937
+ '404':
938
+ description: Credit card not found
939
+
940
+ /credit-cards/{id}/statement:
941
+ get:
942
+ summary: Get credit card statement for a specific month
943
+ parameters:
944
+ - name: id
945
+ in: path
946
+ required: true
947
+ schema:
948
+ type: string
949
+ description: Credit card ID
950
+ - name: month
951
+ in: query
952
+ required: true
953
+ schema:
954
+ type: string
955
+ pattern: "^\\d{4}-\\d{2}$"
956
+ description: Month in YYYY-MM format
957
+ example: "2026-03"
958
+ responses:
959
+ '200':
960
+ description: Credit card statement
961
+ content:
962
+ application/json:
963
+ schema:
964
+ $ref: '#/components/schemas/Statement'
965
+ '401':
966
+ $ref: '#/components/responses/UnauthorizedError'
967
+ '404':
968
+ description: Credit card not found
969
+
970
+ /credit-cards/{id}/pay-statement:
971
+ post:
972
+ summary: Mark all transactions in a credit card statement as paid
973
+ parameters:
974
+ - name: id
975
+ in: path
976
+ required: true
977
+ schema:
978
+ type: string
979
+ description: Credit card ID
980
+ requestBody:
981
+ required: true
982
+ content:
983
+ application/json:
984
+ schema:
985
+ type: object
986
+ required:
987
+ - month
988
+ - paymentAccountId
989
+ properties:
990
+ month:
991
+ type: string
992
+ pattern: "^\\d{4}-\\d{2}$"
993
+ description: Month in YYYY-MM format
994
+ example: "2026-03"
995
+ paymentAccountId:
996
+ type: string
997
+ description: ID of the account to debit for the payment
998
+ example: "acc_123456789"
999
+ responses:
1000
+ '200':
1001
+ description: Statement marked as paid
1002
+ content:
1003
+ application/json:
1004
+ schema:
1005
+ type: object
1006
+ properties:
1007
+ message:
1008
+ type: string
1009
+ example: "Statement for March 2026 marked as paid and linked to account acc_123456789"
1010
+ '400':
1011
+ description: Invalid input or statement is already paid
1012
+ '401':
1013
+ $ref: '#/components/responses/UnauthorizedError'
1014
+ '404':
1015
+ description: Credit card not found
1016
+
1017
+ /credit-cards/{id}/statement-status:
1018
+ get:
1019
+ summary: Get credit card statement payment status for a specific month
1020
+ parameters:
1021
+ - name: id
1022
+ in: path
1023
+ required: true
1024
+ schema:
1025
+ type: string
1026
+ description: Credit card ID
1027
+ - name: month
1028
+ in: query
1029
+ required: true
1030
+ schema:
1031
+ type: string
1032
+ pattern: "^\\d{4}-\\d{2}$"
1033
+ description: Month in YYYY-MM format
1034
+ example: "2026-03"
1035
+ responses:
1036
+ '200':
1037
+ description: Credit card statement status
1038
+ content:
1039
+ application/json:
1040
+ schema:
1041
+ $ref: '#/components/schemas/StatementStatus'
1042
+ '401':
1043
+ $ref: '#/components/responses/UnauthorizedError'
1044
+ '404':
1045
+ description: Credit card not found
1046
+
1047
+ /transactions:
1048
+ post:
1049
+ summary: Create a new transaction
1050
+ requestBody:
1051
+ required: true
1052
+ content:
1053
+ application/json:
1054
+ schema:
1055
+ type: object
1056
+ required:
1057
+ - type
1058
+ - name
1059
+ - amount
1060
+ - date
1061
+ properties:
1062
+ type:
1063
+ $ref: '#/components/schemas/Transaction/properties/type'
1064
+ name:
1065
+ $ref: '#/components/schemas/Transaction/properties/name'
1066
+ amount:
1067
+ $ref: '#/components/schemas/Transaction/properties/amount'
1068
+ date:
1069
+ $ref: '#/components/schemas/Transaction/properties/date'
1070
+ categoryId:
1071
+ $ref: '#/components/schemas/Transaction/properties/categoryId'
1072
+ paymentMethod:
1073
+ $ref: '#/components/schemas/Transaction/properties/paymentMethod'
1074
+ creditCardId:
1075
+ $ref: '#/components/schemas/Transaction/properties/creditCardId'
1076
+ accountId:
1077
+ type: string
1078
+ description: ID of the associated account (required if paymentMethod is not CREDIT)
1079
+ example: "acc_123456789"
1080
+ installments:
1081
+ type: integer
1082
+ minimum: 1
1083
+ description: Number of installments (optional)
1084
+ example: 3
1085
+ targetDueMonth:
1086
+ type: string
1087
+ pattern: "^\\d{4}-\\d{2}$"
1088
+ description: Target month for due date in YYYY-MM format (optional)
1089
+ example: "2026-03"
1090
+ purchaseDate:
1091
+ type: string
1092
+ format: date
1093
+ description: Actual purchase date (credit card only, optional)
1094
+ example: "2026-02-10"
1095
+ recurrence:
1096
+ type: object
1097
+ properties:
1098
+ frequency:
1099
+ $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
1100
+ interval:
1101
+ $ref: '#/components/schemas/RecurrenceRule/properties/interval'
1102
+ endDate:
1103
+ $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
1104
+ occurrences:
1105
+ $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
1106
+ responses:
1107
+ '201':
1108
+ description: Transaction created successfully
1109
+ content:
1110
+ application/json:
1111
+ schema:
1112
+ $ref: '#/components/schemas/Transaction'
1113
+ '400':
1114
+ description: Invalid input or target statement is already closed (paid)
1115
+ '401':
1116
+ $ref: '#/components/responses/UnauthorizedError'
1117
+
1118
+ get:
1119
+ summary: Get all transactions
1120
+ parameters:
1121
+ - name: month
1122
+ in: query
1123
+ required: false
1124
+ schema:
1125
+ type: string
1126
+ pattern: "^\\d{4}-\\d{2}$"
1127
+ description: Filter transactions by month (YYYY-MM format)
1128
+ example: "2026-03"
1129
+ - name: accountId
1130
+ in: query
1131
+ required: false
1132
+ schema:
1133
+ type: string
1134
+ description: Filter transactions by account ID
1135
+ example: "acc_123456789"
1136
+ - name: categoryId
1137
+ in: query
1138
+ required: false
1139
+ schema:
1140
+ type: string
1141
+ description: Filter transactions by category ID
1142
+ example: "cat_123456789"
1143
+ - name: creditCardId
1144
+ in: query
1145
+ required: false
1146
+ schema:
1147
+ type: string
1148
+ description: Filter transactions by credit card ID
1149
+ example: "cc_123456789"
1150
+ - name: type
1151
+ in: query
1152
+ required: false
1153
+ schema:
1154
+ type: string
1155
+ enum: [INCOME, EXPENSE]
1156
+ description: Filter transactions by type
1157
+ example: "EXPENSE"
1158
+ - name: startDate
1159
+ in: query
1160
+ required: false
1161
+ schema:
1162
+ type: string
1163
+ format: date
1164
+ description: Filter transactions starting from this date (inclusive)
1165
+ example: "2026-01-01"
1166
+ - name: endDate
1167
+ in: query
1168
+ required: false
1169
+ schema:
1170
+ type: string
1171
+ format: date
1172
+ description: Filter transactions up to this date (inclusive)
1173
+ example: "2026-01-31"
1174
+ - name: paid
1175
+ in: query
1176
+ required: false
1177
+ schema:
1178
+ type: boolean
1179
+ description: Filter by payment status (true = paid, false = unpaid)
1180
+ example: false
1181
+ responses:
1182
+ '200':
1183
+ description: List of transactions
1184
+ content:
1185
+ application/json:
1186
+ schema:
1187
+ type: array
1188
+ items:
1189
+ $ref: '#/components/schemas/Transaction'
1190
+ '401':
1191
+ $ref: '#/components/responses/UnauthorizedError'
1192
+
1193
+ /transactions/{id}/pay:
1194
+ patch:
1195
+ summary: Mark a transaction as paid/received
1196
+ description: |
1197
+ Marks a transaction as paid or received.
1198
+ **Note:** Credit card transactions cannot be marked as paid directly. They are automatically
1199
+ marked as paid when the credit card statement is paid via the `POST /credit-cards/{id}/pay-statement` endpoint.
1200
+ parameters:
1201
+ - name: id
1202
+ in: path
1203
+ required: true
1204
+ schema:
1205
+ type: string
1206
+ description: Transaction ID
1207
+ responses:
1208
+ '200':
1209
+ description: Transaction marked as paid
1210
+ content:
1211
+ application/json:
1212
+ schema:
1213
+ $ref: '#/components/schemas/Transaction'
1214
+ '400':
1215
+ description: Cannot mark credit card transaction as paid directly
1216
+ '401':
1217
+ $ref: '#/components/responses/UnauthorizedError'
1218
+ '404':
1219
+ description: Transaction not found
1220
+
1221
+ /transactions/{id}/unpay:
1222
+ patch:
1223
+ summary: Mark a transaction as unpaid
1224
+ parameters:
1225
+ - name: id
1226
+ in: path
1227
+ required: true
1228
+ schema:
1229
+ type: string
1230
+ description: Transaction ID
1231
+ responses:
1232
+ '200':
1233
+ description: Transaction marked as unpaid
1234
+ content:
1235
+ application/json:
1236
+ schema:
1237
+ $ref: '#/components/schemas/Transaction'
1238
+ '404':
1239
+ description: Transaction not found
1240
+ '401':
1241
+ $ref: '#/components/responses/UnauthorizedError'
1242
+
1243
+ /transactions/{id}:
1244
+ get:
1245
+ summary: Get a transaction by ID
1246
+ parameters:
1247
+ - name: id
1248
+ in: path
1249
+ required: true
1250
+ schema:
1251
+ type: string
1252
+ description: Transaction ID
1253
+ responses:
1254
+ '200':
1255
+ description: Transaction found
1256
+ content:
1257
+ application/json:
1258
+ schema:
1259
+ $ref: '#/components/schemas/Transaction'
1260
+ '401':
1261
+ $ref: '#/components/responses/UnauthorizedError'
1262
+ '404':
1263
+ description: Transaction not found
1264
+
1265
+ patch:
1266
+ summary: Update a transaction
1267
+ description: |
1268
+ Update a transaction.
1269
+ **Note:** Transactions that have already been paid cannot be edited.
1270
+ For credit card transactions, you can use targetDueMonth to automatically calculate the date based on the credit card's due day.
1271
+
1272
+ **Recurring Transactions - Editable Fields by Mode:**
1273
+ - **SINGLE**: Can edit `name`, `categoryId`, `date`, `targetDueMonth`, `amount`
1274
+ - **PENDING/ALL**: Can edit `name`, `categoryId`, `amount`, `paymentMethod`, `accountId`, `creditCardId` (date and type are restricted to prevent desynchronization)
1275
+
1276
+ **Installment Transactions - Editable Fields by Mode:**
1277
+ - **PENDING/ALL**: Only `name`, `categoryId`, and `amount` are propagated to other installments. All other fields are ignored for the bulk update.
1278
+ parameters:
1279
+ - name: id
1280
+ in: path
1281
+ required: true
1282
+ schema:
1283
+ type: string
1284
+ description: Transaction ID
1285
+ - name: mode
1286
+ in: query
1287
+ required: false
1288
+ schema:
1289
+ type: string
1290
+ enum: [SINGLE, PENDING, ALL]
1291
+ default: SINGLE
1292
+ description: |
1293
+ Update mode for recurring or installment transactions:
1294
+ - **SINGLE**: Update only this specific transaction (default)
1295
+ - **PENDING**: Update this transaction and all future unpaid transactions in the same recurrence series or installment group
1296
+ - **ALL**: For recurrences, update all transactions (paid or unpaid). For installments, behaves the same as PENDING (only unpaid installments from this one onward are updated)
1297
+
1298
+ If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1299
+ example: SINGLE
1300
+ requestBody:
1301
+ required: true
1302
+ content:
1303
+ application/json:
1304
+ schema:
1305
+ $ref: '#/components/schemas/UpdateTransactionRequest'
1306
+ responses:
1307
+ '200':
1308
+ description: Transaction updated successfully
1309
+ content:
1310
+ application/json:
1311
+ schema:
1312
+ $ref: '#/components/schemas/Transaction'
1313
+ '400':
1314
+ description: Invalid input or transaction is already paid
1315
+ '401':
1316
+ $ref: '#/components/responses/UnauthorizedError'
1317
+ '404':
1318
+ description: Transaction not found
1319
+
1320
+ delete:
1321
+ summary: Delete a transaction
1322
+ parameters:
1323
+ - name: id
1324
+ in: path
1325
+ required: true
1326
+ schema:
1327
+ type: string
1328
+ description: Transaction ID
1329
+ - name: mode
1330
+ in: query
1331
+ required: false
1332
+ schema:
1333
+ type: string
1334
+ enum: [SINGLE, PENDING, ALL]
1335
+ default: SINGLE
1336
+ description: |
1337
+ Deletion mode for recurring or installment transactions:
1338
+ - **SINGLE**: Delete only this specific transaction (default)
1339
+ - **PENDING**: Delete this transaction and all future unpaid transactions in the same recurrence series or installment group
1340
+ - **ALL**: For recurrences, delete all transactions (paid or unpaid). For installments, behaves the same as PENDING (only unpaid installments from this one onward are deleted)
1341
+
1342
+ If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1343
+ example: SINGLE
1344
+ responses:
1345
+ '200':
1346
+ description: Transaction deleted successfully
1347
+ '401':
1348
+ $ref: '#/components/responses/UnauthorizedError'
1349
+ '404':
1350
+ description: Transaction not found
1351
+
1352
+ /summary:
1353
+ get:
1354
+ summary: Get financial summary
1355
+ description: >
1356
+ Returns income, expenses, balance, credit card totals, and category breakdowns.
1357
+ Provide either `month` (YYYY-MM) or both `startDate` and `endDate` (YYYY-MM-DD).
1358
+ parameters:
1359
+ - name: month
1360
+ in: query
1361
+ required: false
1362
+ schema:
1363
+ type: string
1364
+ pattern: "^\\d{4}-\\d{2}$"
1365
+ description: Month in YYYY-MM format
1366
+ example: "2026-02"
1367
+ - name: startDate
1368
+ in: query
1369
+ required: false
1370
+ schema:
1371
+ type: string
1372
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1373
+ description: Start date in YYYY-MM-DD format (use with endDate for a custom range)
1374
+ example: "2026-01-01"
1375
+ - name: endDate
1376
+ in: query
1377
+ required: false
1378
+ schema:
1379
+ type: string
1380
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1381
+ description: End date in YYYY-MM-DD format (use with startDate for a custom range)
1382
+ example: "2026-03-31"
1383
+ responses:
1384
+ '200':
1385
+ description: Financial summary for the given period
1386
+ content:
1387
+ application/json:
1388
+ schema:
1389
+ $ref: '#/components/schemas/Summary'
1390
+ '400':
1391
+ description: Invalid or missing period parameters
1392
+ '401':
1393
+ $ref: '#/components/responses/UnauthorizedError'
1394
+
1395
+ /accounts:
1396
+ post:
1397
+ summary: Create a new account
1398
+ requestBody:
1399
+ required: true
1400
+ content:
1401
+ application/json:
1402
+ schema:
1403
+ type: object
1404
+ required:
1405
+ - name
1406
+ - type
1407
+ properties:
1408
+ name:
1409
+ type: string
1410
+ description: Name of the account
1411
+ example: "Itaú Checking Account"
1412
+ type:
1413
+ type: string
1414
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1415
+ description: Type of account
1416
+ example: "BANK_ACCOUNT"
1417
+ initialBalance:
1418
+ type: number
1419
+ format: float
1420
+ description: Initial balance for the account
1421
+ example: 1000.00
1422
+ responses:
1423
+ '201':
1424
+ description: Account created successfully
1425
+ content:
1426
+ application/json:
1427
+ schema:
1428
+ $ref: '#/components/schemas/Account'
1429
+ '400':
1430
+ description: Invalid input
1431
+ '401':
1432
+ $ref: '#/components/responses/UnauthorizedError'
1433
+
1434
+ get:
1435
+ summary: Get all accounts
1436
+ responses:
1437
+ '200':
1438
+ description: List of accounts with current balances
1439
+ content:
1440
+ application/json:
1441
+ schema:
1442
+ type: array
1443
+ items:
1444
+ $ref: '#/components/schemas/Account'
1445
+ '401':
1446
+ $ref: '#/components/responses/UnauthorizedError'
1447
+
1448
+ /accounts/{id}:
1449
+ get:
1450
+ summary: Get a specific account
1451
+ parameters:
1452
+ - name: id
1453
+ in: path
1454
+ required: true
1455
+ schema:
1456
+ type: string
1457
+ description: Account ID
1458
+ responses:
1459
+ '200':
1460
+ description: Account details
1461
+ content:
1462
+ application/json:
1463
+ schema:
1464
+ $ref: '#/components/schemas/Account'
1465
+ '401':
1466
+ $ref: '#/components/responses/UnauthorizedError'
1467
+ '404':
1468
+ description: Account not found
1469
+
1470
+ patch:
1471
+ summary: Update an account
1472
+ parameters:
1473
+ - name: id
1474
+ in: path
1475
+ required: true
1476
+ schema:
1477
+ type: string
1478
+ description: Account ID
1479
+ requestBody:
1480
+ required: true
1481
+ content:
1482
+ application/json:
1483
+ schema:
1484
+ type: object
1485
+ properties:
1486
+ name:
1487
+ type: string
1488
+ description: Name of the account
1489
+ example: "Itaú Savings Account"
1490
+ type:
1491
+ type: string
1492
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1493
+ description: Type of account
1494
+ example: "SAVINGS_ACCOUNT"
1495
+ responses:
1496
+ '200':
1497
+ description: Account updated successfully
1498
+ content:
1499
+ application/json:
1500
+ schema:
1501
+ $ref: '#/components/schemas/Account'
1502
+ '400':
1503
+ description: Invalid input
1504
+ '401':
1505
+ $ref: '#/components/responses/UnauthorizedError'
1506
+ '404':
1507
+ description: Account not found
1508
+
1509
+ delete:
1510
+ summary: Delete an account
1511
+ parameters:
1512
+ - name: id
1513
+ in: path
1514
+ required: true
1515
+ schema:
1516
+ type: string
1517
+ description: Account ID
1518
+ responses:
1519
+ '204':
1520
+ description: Account deleted successfully
1521
+ '401':
1522
+ $ref: '#/components/responses/UnauthorizedError'
1523
+ '404':
1524
+ description: Account not found
1525
+ '409':
1526
+ description: Cannot delete account with associated transactions
1527
+
1528
+ /accounts/{id}/balance:
1529
+ get:
1530
+ summary: Get the current balance for an account
1531
+ parameters:
1532
+ - name: id
1533
+ in: path
1534
+ required: true
1535
+ schema:
1536
+ type: string
1537
+ description: Account ID
1538
+ responses:
1539
+ '200':
1540
+ description: Account balance
1541
+ content:
1542
+ application/json:
1543
+ schema:
1544
+ $ref: '#/components/schemas/AccountBalance'
1545
+ '401':
1546
+ $ref: '#/components/responses/UnauthorizedError'
1547
+ '404':
1548
+ description: Account not found
1549
+
1550
+ /accounts/{id}/transactions:
1551
+ get:
1552
+ summary: Get all transactions linked to an account
1553
+ parameters:
1554
+ - name: id
1555
+ in: path
1556
+ required: true
1557
+ schema:
1558
+ type: string
1559
+ description: Account ID
1560
+ responses:
1561
+ '200':
1562
+ description: List of transactions linked to the account
1563
+ content:
1564
+ application/json:
1565
+ schema:
1566
+ type: array
1567
+ items:
1568
+ $ref: '#/components/schemas/Transaction'
1569
+ '401':
1570
+ $ref: '#/components/responses/UnauthorizedError'
1571
+ '404':
1572
+ description: Account not found
1573
+
1574
+ /export:
1575
+ get:
1576
+ summary: Export all user data
1577
+ description: Returns a complete backup of all user data including settings, categories, accounts, credit cards, recurrence rules, and transactions.
1578
+ security:
1579
+ - ApiKeyAuth: []
1580
+ responses:
1581
+ '200':
1582
+ description: Export payload with all data
1583
+ content:
1584
+ application/json:
1585
+ schema:
1586
+ type: object
1587
+ properties:
1588
+ version:
1589
+ type: string
1590
+ example: "1.0"
1591
+ exportedAt:
1592
+ type: string
1593
+ format: date-time
1594
+ example: "2026-02-14T21:00:00.000Z"
1595
+ data:
1596
+ type: object
1597
+ properties:
1598
+ settings:
1599
+ nullable: true
1600
+ $ref: '#/components/schemas/Settings'
1601
+ categories:
1602
+ type: array
1603
+ items:
1604
+ $ref: '#/components/schemas/Category'
1605
+ accounts:
1606
+ type: array
1607
+ items:
1608
+ $ref: '#/components/schemas/Account'
1609
+ creditCards:
1610
+ type: array
1611
+ items:
1612
+ $ref: '#/components/schemas/CreditCard'
1613
+ recurrenceRules:
1614
+ type: array
1615
+ items:
1616
+ $ref: '#/components/schemas/RecurrenceRule'
1617
+ transactions:
1618
+ type: array
1619
+ items:
1620
+ $ref: '#/components/schemas/Transaction'
1621
+ '401':
1622
+ $ref: '#/components/responses/UnauthorizedError'
1623
+
1624
+ /import:
1625
+ post:
1626
+ summary: Import user data
1627
+ description: |
1628
+ Imports a previously exported backup. Supports two modes:
1629
+ - **reset**: Clears all existing data and replaces it with the imported data.
1630
+ - **increment**: Adds new records from the import, ignoring records whose IDs already exist.
1631
+ security:
1632
+ - ApiKeyAuth: []
1633
+ requestBody:
1634
+ required: true
1635
+ content:
1636
+ application/json:
1637
+ schema:
1638
+ type: object
1639
+ required:
1640
+ - mode
1641
+ - version
1642
+ - exportedAt
1643
+ - data
1644
+ properties:
1645
+ mode:
1646
+ type: string
1647
+ enum: [reset, increment]
1648
+ description: Import mode
1649
+ example: "reset"
1650
+ version:
1651
+ type: string
1652
+ description: Export format version. Must be "1.0".
1653
+ example: "1.0"
1654
+ exportedAt:
1655
+ type: string
1656
+ format: date-time
1657
+ example: "2026-02-14T21:00:00.000Z"
1658
+ data:
1659
+ type: object
1660
+ properties:
1661
+ settings:
1662
+ nullable: true
1663
+ $ref: '#/components/schemas/Settings'
1664
+ categories:
1665
+ type: array
1666
+ items:
1667
+ $ref: '#/components/schemas/Category'
1668
+ accounts:
1669
+ type: array
1670
+ items:
1671
+ $ref: '#/components/schemas/Account'
1672
+ creditCards:
1673
+ type: array
1674
+ items:
1675
+ $ref: '#/components/schemas/CreditCard'
1676
+ recurrenceRules:
1677
+ type: array
1678
+ items:
1679
+ $ref: '#/components/schemas/RecurrenceRule'
1680
+ transactions:
1681
+ type: array
1682
+ items:
1683
+ $ref: '#/components/schemas/Transaction'
1684
+ responses:
1685
+ '200':
1686
+ description: Import completed successfully
1687
+ content:
1688
+ application/json:
1689
+ schema:
1690
+ type: object
1691
+ properties:
1692
+ message:
1693
+ type: string
1694
+ example: "Import completed successfully (mode: reset)"
1695
+ '400':
1696
+ description: Invalid input or unsupported version
1697
+ '401':
1698
+ $ref: '#/components/responses/UnauthorizedError'
1699
+
1700
+ /settings:
1701
+ post:
1702
+ summary: Create global settings (only if not exists)
1703
+ requestBody:
1704
+ required: true
1705
+ content:
1706
+ application/json:
1707
+ schema:
1708
+ type: object
1709
+ required:
1710
+ - userName
1711
+ - language
1712
+ - currency
1713
+ properties:
1714
+ userName:
1715
+ type: string
1716
+ example: "John Doe"
1717
+ language:
1718
+ type: string
1719
+ enum: [pt-BR, en-US]
1720
+ example: "pt-BR"
1721
+ currency:
1722
+ type: string
1723
+ enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1724
+ example: "BRL"
1725
+ responses:
1726
+ '201':
1727
+ description: Settings created successfully
1728
+ content:
1729
+ application/json:
1730
+ schema:
1731
+ $ref: '#/components/schemas/Settings'
1732
+ '400':
1733
+ description: Invalid input
1734
+ '401':
1735
+ $ref: '#/components/responses/UnauthorizedError'
1736
+ '409':
1737
+ description: Settings already exist
1738
+
1739
+ get:
1740
+ summary: Get global settings
1741
+ responses:
1742
+ '200':
1743
+ description: Settings retrieved successfully
1744
+ content:
1745
+ application/json:
1746
+ schema:
1747
+ $ref: '#/components/schemas/Settings'
1748
+ '401':
1749
+ $ref: '#/components/responses/UnauthorizedError'
1750
+ '404':
1751
+ description: Settings not found
1752
+
1753
+ put:
1754
+ summary: Update global settings
1755
+ requestBody:
1756
+ required: true
1757
+ content:
1758
+ application/json:
1759
+ schema:
1760
+ type: object
1761
+ properties:
1762
+ userName:
1763
+ type: string
1764
+ example: "John Doe"
1765
+ language:
1766
+ type: string
1767
+ enum: [pt-BR, en-US]
1768
+ example: "pt-BR"
1769
+ currency:
1770
+ type: string
1771
+ enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1772
+ example: "BRL"
1773
+ responses:
1774
+ '200':
1775
+ description: Settings updated successfully
1776
+ content:
1777
+ application/json:
1778
+ schema:
1779
+ $ref: '#/components/schemas/Settings'
1780
+ '400':
1781
+ description: Invalid input
1782
+ '401':
1783
+ $ref: '#/components/responses/UnauthorizedError'
1784
+ '404':
1785
+ description: Settings not found
1786
+