quantix-mcp 0.3.7 → 0.3.9

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 (105) hide show
  1. package/.github/agents/copilot-instructions.md +32 -32
  2. package/.github/copilot-instructions.md +17 -17
  3. package/.github/workflows/publish.yaml +28 -28
  4. package/.opencode/command/speckit.analyze.md +184 -184
  5. package/.opencode/command/speckit.checklist.md +294 -294
  6. package/.opencode/command/speckit.clarify.md +181 -181
  7. package/.opencode/command/speckit.constitution.md +84 -84
  8. package/.opencode/command/speckit.implement.md +135 -135
  9. package/.opencode/command/speckit.plan.md +89 -89
  10. package/.opencode/command/speckit.specify.md +258 -258
  11. package/.opencode/command/speckit.tasks.md +137 -137
  12. package/.opencode/command/speckit.taskstoissues.md +30 -30
  13. package/.specify/memory/constitution.md +58 -58
  14. package/.specify/templates/constitution-template.md +50 -50
  15. package/.vscode/launch.json +14 -14
  16. package/CLAUDE.md +64 -64
  17. package/README.md +176 -176
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +6 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/tools/accounts.d.ts.map +1 -1
  22. package/dist/tools/accounts.js +64 -28
  23. package/dist/tools/accounts.js.map +1 -1
  24. package/dist/tools/categories.d.ts.map +1 -1
  25. package/dist/tools/categories.js +46 -20
  26. package/dist/tools/categories.js.map +1 -1
  27. package/dist/tools/credit-cards.d.ts.map +1 -1
  28. package/dist/tools/credit-cards.js +89 -33
  29. package/dist/tools/credit-cards.js.map +1 -1
  30. package/dist/tools/data.d.ts.map +1 -1
  31. package/dist/tools/data.js +19 -8
  32. package/dist/tools/data.js.map +1 -1
  33. package/dist/tools/settings.d.ts.map +1 -1
  34. package/dist/tools/settings.js +28 -12
  35. package/dist/tools/settings.js.map +1 -1
  36. package/dist/tools/summary.d.ts.map +1 -1
  37. package/dist/tools/summary.js +17 -11
  38. package/dist/tools/summary.js.map +1 -1
  39. package/dist/tools/transactions.d.ts.map +1 -1
  40. package/dist/tools/transactions.js +86 -50
  41. package/dist/tools/transactions.js.map +1 -1
  42. package/dist/tools/transfers.d.ts +3 -0
  43. package/dist/tools/transfers.d.ts.map +1 -0
  44. package/dist/tools/transfers.js +107 -0
  45. package/dist/tools/transfers.js.map +1 -0
  46. package/dist/types/schemas.d.ts +25 -0
  47. package/dist/types/schemas.d.ts.map +1 -1
  48. package/dist/types/schemas.js +28 -2
  49. package/dist/types/schemas.js.map +1 -1
  50. package/dist/utils/toolHelpers.d.ts +7 -0
  51. package/dist/utils/toolHelpers.d.ts.map +1 -0
  52. package/dist/utils/toolHelpers.js +11 -0
  53. package/dist/utils/toolHelpers.js.map +1 -0
  54. package/openapi.yaml +2045 -1828
  55. package/package.json +41 -41
  56. package/specs/001-mcp-api-integration/checklists/requirements.md +34 -34
  57. package/specs/001-mcp-api-integration/contracts/openapi.yaml +635 -635
  58. package/specs/001-mcp-api-integration/data-model.md +106 -106
  59. package/specs/001-mcp-api-integration/plan.md +73 -73
  60. package/specs/001-mcp-api-integration/quickstart.md +74 -74
  61. package/specs/001-mcp-api-integration/research.md +58 -58
  62. package/specs/001-mcp-api-integration/spec.md +119 -119
  63. package/specs/001-mcp-api-integration/tasks.md +64 -64
  64. package/src/config.ts +36 -36
  65. package/src/index.ts +49 -47
  66. package/src/services/apiClient.ts +49 -49
  67. package/src/tools/accounts.ts +140 -111
  68. package/src/tools/categories.ts +102 -81
  69. package/src/tools/credit-cards.ts +184 -147
  70. package/src/tools/data.ts +45 -36
  71. package/src/tools/settings.ts +64 -51
  72. package/src/tools/summary.ts +29 -24
  73. package/src/tools/transactions.ts +157 -128
  74. package/src/tools/transfers.ts +122 -0
  75. package/src/types/schemas.ts +260 -235
  76. package/src/utils/toolHelpers.ts +11 -0
  77. package/tests/benchmark.test.d.ts +1 -1
  78. package/tests/benchmark.test.js +32 -32
  79. package/tests/benchmark.test.ts +38 -38
  80. package/tests/server.test.d.ts +1 -1
  81. package/tests/server.test.js +12 -12
  82. package/tests/server.test.ts +14 -14
  83. package/tests/setup.d.ts +3 -3
  84. package/tests/setup.js +16 -16
  85. package/tests/setup.ts +20 -20
  86. package/tests/tools/accounts.test.ts +159 -118
  87. package/tests/tools/categories.test.d.ts +1 -1
  88. package/tests/tools/categories.test.js +62 -62
  89. package/tests/tools/categories.test.ts +120 -78
  90. package/tests/tools/credit-cards.test.d.ts +1 -1
  91. package/tests/tools/credit-cards.test.js +70 -70
  92. package/tests/tools/credit-cards.test.ts +131 -89
  93. package/tests/tools/data.test.ts +100 -0
  94. package/tests/tools/settings.test.ts +116 -0
  95. package/tests/tools/summary.test.d.ts +1 -1
  96. package/tests/tools/summary.test.js +35 -35
  97. package/tests/tools/summary.test.ts +63 -42
  98. package/tests/tools/transactions.test.d.ts +1 -1
  99. package/tests/tools/transactions.test.js +66 -66
  100. package/tests/tools/transactions.test.ts +133 -82
  101. package/tests/tools/transfers.test.ts +141 -0
  102. package/tsconfig.json +52 -52
  103. package/vitest.config.d.ts +2 -2
  104. package/vitest.config.js +13 -13
  105. package/vitest.config.ts +14 -14
package/openapi.yaml CHANGED
@@ -1,1828 +1,2045 @@
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}/reopen-statement:
1018
- post:
1019
- summary: Reopen a credit card statement by marking all transactions as unpaid
1020
- parameters:
1021
- - name: id
1022
- in: path
1023
- required: true
1024
- schema:
1025
- type: string
1026
- description: Credit card ID
1027
- requestBody:
1028
- required: true
1029
- content:
1030
- application/json:
1031
- schema:
1032
- type: object
1033
- required:
1034
- - month
1035
- properties:
1036
- month:
1037
- type: string
1038
- pattern: "^\\d{4}-\\d{2}$"
1039
- description: Month in YYYY-MM format
1040
- example: "2026-03"
1041
- responses:
1042
- '200':
1043
- description: Statement reopened successfully
1044
- content:
1045
- application/json:
1046
- schema:
1047
- type: object
1048
- properties:
1049
- message:
1050
- type: string
1051
- example: "Statement for 2026-03 successfully reopened. 5 transaction(s) marked as unpaid."
1052
- '400':
1053
- description: Invalid input or statement is already open
1054
- '401':
1055
- $ref: '#/components/responses/UnauthorizedError'
1056
- '404':
1057
- description: Credit card not found
1058
-
1059
- /credit-cards/{id}/statement-status:
1060
- get:
1061
- summary: Get credit card statement payment status for a specific month
1062
- parameters:
1063
- - name: id
1064
- in: path
1065
- required: true
1066
- schema:
1067
- type: string
1068
- description: Credit card ID
1069
- - name: month
1070
- in: query
1071
- required: true
1072
- schema:
1073
- type: string
1074
- pattern: "^\\d{4}-\\d{2}$"
1075
- description: Month in YYYY-MM format
1076
- example: "2026-03"
1077
- responses:
1078
- '200':
1079
- description: Credit card statement status
1080
- content:
1081
- application/json:
1082
- schema:
1083
- $ref: '#/components/schemas/StatementStatus'
1084
- '401':
1085
- $ref: '#/components/responses/UnauthorizedError'
1086
- '404':
1087
- description: Credit card not found
1088
-
1089
- /transactions:
1090
- post:
1091
- summary: Create a new transaction
1092
- requestBody:
1093
- required: true
1094
- content:
1095
- application/json:
1096
- schema:
1097
- type: object
1098
- required:
1099
- - type
1100
- - name
1101
- - amount
1102
- - date
1103
- properties:
1104
- type:
1105
- $ref: '#/components/schemas/Transaction/properties/type'
1106
- name:
1107
- $ref: '#/components/schemas/Transaction/properties/name'
1108
- amount:
1109
- $ref: '#/components/schemas/Transaction/properties/amount'
1110
- date:
1111
- $ref: '#/components/schemas/Transaction/properties/date'
1112
- categoryId:
1113
- $ref: '#/components/schemas/Transaction/properties/categoryId'
1114
- paymentMethod:
1115
- $ref: '#/components/schemas/Transaction/properties/paymentMethod'
1116
- creditCardId:
1117
- $ref: '#/components/schemas/Transaction/properties/creditCardId'
1118
- accountId:
1119
- type: string
1120
- description: ID of the associated account (required if paymentMethod is not CREDIT)
1121
- example: "acc_123456789"
1122
- installments:
1123
- type: integer
1124
- minimum: 1
1125
- description: Number of installments (optional)
1126
- example: 3
1127
- targetDueMonth:
1128
- type: string
1129
- pattern: "^\\d{4}-\\d{2}$"
1130
- description: Target month for due date in YYYY-MM format (optional)
1131
- example: "2026-03"
1132
- purchaseDate:
1133
- type: string
1134
- format: date
1135
- description: Actual purchase date (credit card only, optional)
1136
- example: "2026-02-10"
1137
- recurrence:
1138
- type: object
1139
- properties:
1140
- frequency:
1141
- $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
1142
- interval:
1143
- $ref: '#/components/schemas/RecurrenceRule/properties/interval'
1144
- endDate:
1145
- $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
1146
- occurrences:
1147
- $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
1148
- responses:
1149
- '201':
1150
- description: Transaction created successfully
1151
- content:
1152
- application/json:
1153
- schema:
1154
- $ref: '#/components/schemas/Transaction'
1155
- '400':
1156
- description: Invalid input or target statement is already closed (paid)
1157
- '401':
1158
- $ref: '#/components/responses/UnauthorizedError'
1159
-
1160
- get:
1161
- summary: Get all transactions
1162
- parameters:
1163
- - name: month
1164
- in: query
1165
- required: false
1166
- schema:
1167
- type: string
1168
- pattern: "^\\d{4}-\\d{2}$"
1169
- description: Filter transactions by month (YYYY-MM format)
1170
- example: "2026-03"
1171
- - name: accountId
1172
- in: query
1173
- required: false
1174
- schema:
1175
- type: string
1176
- description: Filter transactions by account ID
1177
- example: "acc_123456789"
1178
- - name: categoryId
1179
- in: query
1180
- required: false
1181
- schema:
1182
- type: string
1183
- description: Filter transactions by category ID
1184
- example: "cat_123456789"
1185
- - name: creditCardId
1186
- in: query
1187
- required: false
1188
- schema:
1189
- type: string
1190
- description: Filter transactions by credit card ID
1191
- example: "cc_123456789"
1192
- - name: type
1193
- in: query
1194
- required: false
1195
- schema:
1196
- type: string
1197
- enum: [INCOME, EXPENSE]
1198
- description: Filter transactions by type
1199
- example: "EXPENSE"
1200
- - name: startDate
1201
- in: query
1202
- required: false
1203
- schema:
1204
- type: string
1205
- format: date
1206
- description: Filter transactions starting from this date (inclusive)
1207
- example: "2026-01-01"
1208
- - name: endDate
1209
- in: query
1210
- required: false
1211
- schema:
1212
- type: string
1213
- format: date
1214
- description: Filter transactions up to this date (inclusive)
1215
- example: "2026-01-31"
1216
- - name: paid
1217
- in: query
1218
- required: false
1219
- schema:
1220
- type: boolean
1221
- description: Filter by payment status (true = paid, false = unpaid)
1222
- example: false
1223
- responses:
1224
- '200':
1225
- description: List of transactions
1226
- content:
1227
- application/json:
1228
- schema:
1229
- type: array
1230
- items:
1231
- $ref: '#/components/schemas/Transaction'
1232
- '401':
1233
- $ref: '#/components/responses/UnauthorizedError'
1234
-
1235
- /transactions/{id}/pay:
1236
- patch:
1237
- summary: Mark a transaction as paid/received
1238
- description: |
1239
- Marks a transaction as paid or received.
1240
- **Note:** Credit card transactions cannot be marked as paid directly. They are automatically
1241
- marked as paid when the credit card statement is paid via the `POST /credit-cards/{id}/pay-statement` endpoint.
1242
- parameters:
1243
- - name: id
1244
- in: path
1245
- required: true
1246
- schema:
1247
- type: string
1248
- description: Transaction ID
1249
- responses:
1250
- '200':
1251
- description: Transaction marked as paid
1252
- content:
1253
- application/json:
1254
- schema:
1255
- $ref: '#/components/schemas/Transaction'
1256
- '400':
1257
- description: Cannot mark credit card transaction as paid directly
1258
- '401':
1259
- $ref: '#/components/responses/UnauthorizedError'
1260
- '404':
1261
- description: Transaction not found
1262
-
1263
- /transactions/{id}/unpay:
1264
- patch:
1265
- summary: Mark a transaction as unpaid
1266
- parameters:
1267
- - name: id
1268
- in: path
1269
- required: true
1270
- schema:
1271
- type: string
1272
- description: Transaction ID
1273
- responses:
1274
- '200':
1275
- description: Transaction marked as unpaid
1276
- content:
1277
- application/json:
1278
- schema:
1279
- $ref: '#/components/schemas/Transaction'
1280
- '404':
1281
- description: Transaction not found
1282
- '401':
1283
- $ref: '#/components/responses/UnauthorizedError'
1284
-
1285
- /transactions/{id}:
1286
- get:
1287
- summary: Get a transaction by ID
1288
- parameters:
1289
- - name: id
1290
- in: path
1291
- required: true
1292
- schema:
1293
- type: string
1294
- description: Transaction ID
1295
- responses:
1296
- '200':
1297
- description: Transaction found
1298
- content:
1299
- application/json:
1300
- schema:
1301
- $ref: '#/components/schemas/Transaction'
1302
- '401':
1303
- $ref: '#/components/responses/UnauthorizedError'
1304
- '404':
1305
- description: Transaction not found
1306
-
1307
- patch:
1308
- summary: Update a transaction
1309
- description: |
1310
- Update a transaction.
1311
- **Note:** Transactions that have already been paid cannot be edited.
1312
- For credit card transactions, you can use targetDueMonth to automatically calculate the date based on the credit card's due day.
1313
-
1314
- **Recurring Transactions - Editable Fields by Mode:**
1315
- - **SINGLE**: Can edit `name`, `categoryId`, `date`, `targetDueMonth`, `amount`
1316
- - **PENDING/ALL**: Can edit `name`, `categoryId`, `amount`, `paymentMethod`, `accountId`, `creditCardId` (date and type are restricted to prevent desynchronization)
1317
-
1318
- **Installment Transactions - Editable Fields by Mode:**
1319
- - **PENDING/ALL**: Only `name`, `categoryId`, and `amount` are propagated to other installments. All other fields are ignored for the bulk update.
1320
- parameters:
1321
- - name: id
1322
- in: path
1323
- required: true
1324
- schema:
1325
- type: string
1326
- description: Transaction ID
1327
- - name: mode
1328
- in: query
1329
- required: false
1330
- schema:
1331
- type: string
1332
- enum: [SINGLE, PENDING, ALL]
1333
- default: SINGLE
1334
- description: |
1335
- Update mode for recurring or installment transactions:
1336
- - **SINGLE**: Update only this specific transaction (default)
1337
- - **PENDING**: Update this transaction and all future unpaid transactions in the same recurrence series or installment group
1338
- - **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)
1339
-
1340
- If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1341
- example: SINGLE
1342
- requestBody:
1343
- required: true
1344
- content:
1345
- application/json:
1346
- schema:
1347
- $ref: '#/components/schemas/UpdateTransactionRequest'
1348
- responses:
1349
- '200':
1350
- description: Transaction updated successfully
1351
- content:
1352
- application/json:
1353
- schema:
1354
- $ref: '#/components/schemas/Transaction'
1355
- '400':
1356
- description: Invalid input or transaction is already paid
1357
- '401':
1358
- $ref: '#/components/responses/UnauthorizedError'
1359
- '404':
1360
- description: Transaction not found
1361
-
1362
- delete:
1363
- summary: Delete a transaction
1364
- parameters:
1365
- - name: id
1366
- in: path
1367
- required: true
1368
- schema:
1369
- type: string
1370
- description: Transaction ID
1371
- - name: mode
1372
- in: query
1373
- required: false
1374
- schema:
1375
- type: string
1376
- enum: [SINGLE, PENDING, ALL]
1377
- default: SINGLE
1378
- description: |
1379
- Deletion mode for recurring or installment transactions:
1380
- - **SINGLE**: Delete only this specific transaction (default)
1381
- - **PENDING**: Delete this transaction and all future unpaid transactions in the same recurrence series or installment group
1382
- - **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)
1383
-
1384
- If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1385
- example: SINGLE
1386
- responses:
1387
- '200':
1388
- description: Transaction deleted successfully
1389
- '401':
1390
- $ref: '#/components/responses/UnauthorizedError'
1391
- '404':
1392
- description: Transaction not found
1393
-
1394
- /summary:
1395
- get:
1396
- summary: Get financial summary
1397
- description: >
1398
- Returns income, expenses, balance, credit card totals, and category breakdowns.
1399
- Provide either `month` (YYYY-MM) or both `startDate` and `endDate` (YYYY-MM-DD).
1400
- parameters:
1401
- - name: month
1402
- in: query
1403
- required: false
1404
- schema:
1405
- type: string
1406
- pattern: "^\\d{4}-\\d{2}$"
1407
- description: Month in YYYY-MM format
1408
- example: "2026-02"
1409
- - name: startDate
1410
- in: query
1411
- required: false
1412
- schema:
1413
- type: string
1414
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1415
- description: Start date in YYYY-MM-DD format (use with endDate for a custom range)
1416
- example: "2026-01-01"
1417
- - name: endDate
1418
- in: query
1419
- required: false
1420
- schema:
1421
- type: string
1422
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1423
- description: End date in YYYY-MM-DD format (use with startDate for a custom range)
1424
- example: "2026-03-31"
1425
- responses:
1426
- '200':
1427
- description: Financial summary for the given period
1428
- content:
1429
- application/json:
1430
- schema:
1431
- $ref: '#/components/schemas/Summary'
1432
- '400':
1433
- description: Invalid or missing period parameters
1434
- '401':
1435
- $ref: '#/components/responses/UnauthorizedError'
1436
-
1437
- /accounts:
1438
- post:
1439
- summary: Create a new account
1440
- requestBody:
1441
- required: true
1442
- content:
1443
- application/json:
1444
- schema:
1445
- type: object
1446
- required:
1447
- - name
1448
- - type
1449
- properties:
1450
- name:
1451
- type: string
1452
- description: Name of the account
1453
- example: "Itaú Checking Account"
1454
- type:
1455
- type: string
1456
- enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1457
- description: Type of account
1458
- example: "BANK_ACCOUNT"
1459
- initialBalance:
1460
- type: number
1461
- format: float
1462
- description: Initial balance for the account
1463
- example: 1000.00
1464
- responses:
1465
- '201':
1466
- description: Account created successfully
1467
- content:
1468
- application/json:
1469
- schema:
1470
- $ref: '#/components/schemas/Account'
1471
- '400':
1472
- description: Invalid input
1473
- '401':
1474
- $ref: '#/components/responses/UnauthorizedError'
1475
-
1476
- get:
1477
- summary: Get all accounts
1478
- responses:
1479
- '200':
1480
- description: List of accounts with current balances
1481
- content:
1482
- application/json:
1483
- schema:
1484
- type: array
1485
- items:
1486
- $ref: '#/components/schemas/Account'
1487
- '401':
1488
- $ref: '#/components/responses/UnauthorizedError'
1489
-
1490
- /accounts/{id}:
1491
- get:
1492
- summary: Get a specific account
1493
- parameters:
1494
- - name: id
1495
- in: path
1496
- required: true
1497
- schema:
1498
- type: string
1499
- description: Account ID
1500
- responses:
1501
- '200':
1502
- description: Account details
1503
- content:
1504
- application/json:
1505
- schema:
1506
- $ref: '#/components/schemas/Account'
1507
- '401':
1508
- $ref: '#/components/responses/UnauthorizedError'
1509
- '404':
1510
- description: Account not found
1511
-
1512
- patch:
1513
- summary: Update an account
1514
- parameters:
1515
- - name: id
1516
- in: path
1517
- required: true
1518
- schema:
1519
- type: string
1520
- description: Account ID
1521
- requestBody:
1522
- required: true
1523
- content:
1524
- application/json:
1525
- schema:
1526
- type: object
1527
- properties:
1528
- name:
1529
- type: string
1530
- description: Name of the account
1531
- example: "Itaú Savings Account"
1532
- type:
1533
- type: string
1534
- enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1535
- description: Type of account
1536
- example: "SAVINGS_ACCOUNT"
1537
- responses:
1538
- '200':
1539
- description: Account updated successfully
1540
- content:
1541
- application/json:
1542
- schema:
1543
- $ref: '#/components/schemas/Account'
1544
- '400':
1545
- description: Invalid input
1546
- '401':
1547
- $ref: '#/components/responses/UnauthorizedError'
1548
- '404':
1549
- description: Account not found
1550
-
1551
- delete:
1552
- summary: Delete 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
- '204':
1562
- description: Account deleted successfully
1563
- '401':
1564
- $ref: '#/components/responses/UnauthorizedError'
1565
- '404':
1566
- description: Account not found
1567
- '409':
1568
- description: Cannot delete account with associated transactions
1569
-
1570
- /accounts/{id}/balance:
1571
- get:
1572
- summary: Get the current balance for an account
1573
- parameters:
1574
- - name: id
1575
- in: path
1576
- required: true
1577
- schema:
1578
- type: string
1579
- description: Account ID
1580
- responses:
1581
- '200':
1582
- description: Account balance
1583
- content:
1584
- application/json:
1585
- schema:
1586
- $ref: '#/components/schemas/AccountBalance'
1587
- '401':
1588
- $ref: '#/components/responses/UnauthorizedError'
1589
- '404':
1590
- description: Account not found
1591
-
1592
- /accounts/{id}/transactions:
1593
- get:
1594
- summary: Get all transactions linked to an account
1595
- parameters:
1596
- - name: id
1597
- in: path
1598
- required: true
1599
- schema:
1600
- type: string
1601
- description: Account ID
1602
- responses:
1603
- '200':
1604
- description: List of transactions linked to the account
1605
- content:
1606
- application/json:
1607
- schema:
1608
- type: array
1609
- items:
1610
- $ref: '#/components/schemas/Transaction'
1611
- '401':
1612
- $ref: '#/components/responses/UnauthorizedError'
1613
- '404':
1614
- description: Account not found
1615
-
1616
- /export:
1617
- get:
1618
- summary: Export all user data
1619
- description: Returns a complete backup of all user data including settings, categories, accounts, credit cards, recurrence rules, and transactions.
1620
- security:
1621
- - ApiKeyAuth: []
1622
- responses:
1623
- '200':
1624
- description: Export payload with all data
1625
- content:
1626
- application/json:
1627
- schema:
1628
- type: object
1629
- properties:
1630
- version:
1631
- type: string
1632
- example: "1.0"
1633
- exportedAt:
1634
- type: string
1635
- format: date-time
1636
- example: "2026-02-14T21:00:00.000Z"
1637
- data:
1638
- type: object
1639
- properties:
1640
- settings:
1641
- nullable: true
1642
- $ref: '#/components/schemas/Settings'
1643
- categories:
1644
- type: array
1645
- items:
1646
- $ref: '#/components/schemas/Category'
1647
- accounts:
1648
- type: array
1649
- items:
1650
- $ref: '#/components/schemas/Account'
1651
- creditCards:
1652
- type: array
1653
- items:
1654
- $ref: '#/components/schemas/CreditCard'
1655
- recurrenceRules:
1656
- type: array
1657
- items:
1658
- $ref: '#/components/schemas/RecurrenceRule'
1659
- transactions:
1660
- type: array
1661
- items:
1662
- $ref: '#/components/schemas/Transaction'
1663
- '401':
1664
- $ref: '#/components/responses/UnauthorizedError'
1665
-
1666
- /import:
1667
- post:
1668
- summary: Import user data
1669
- description: |
1670
- Imports a previously exported backup. Supports two modes:
1671
- - **reset**: Clears all existing data and replaces it with the imported data.
1672
- - **increment**: Adds new records from the import, ignoring records whose IDs already exist.
1673
- security:
1674
- - ApiKeyAuth: []
1675
- requestBody:
1676
- required: true
1677
- content:
1678
- application/json:
1679
- schema:
1680
- type: object
1681
- required:
1682
- - mode
1683
- - version
1684
- - exportedAt
1685
- - data
1686
- properties:
1687
- mode:
1688
- type: string
1689
- enum: [reset, increment]
1690
- description: Import mode
1691
- example: "reset"
1692
- version:
1693
- type: string
1694
- description: Export format version. Must be "1.0".
1695
- example: "1.0"
1696
- exportedAt:
1697
- type: string
1698
- format: date-time
1699
- example: "2026-02-14T21:00:00.000Z"
1700
- data:
1701
- type: object
1702
- properties:
1703
- settings:
1704
- nullable: true
1705
- $ref: '#/components/schemas/Settings'
1706
- categories:
1707
- type: array
1708
- items:
1709
- $ref: '#/components/schemas/Category'
1710
- accounts:
1711
- type: array
1712
- items:
1713
- $ref: '#/components/schemas/Account'
1714
- creditCards:
1715
- type: array
1716
- items:
1717
- $ref: '#/components/schemas/CreditCard'
1718
- recurrenceRules:
1719
- type: array
1720
- items:
1721
- $ref: '#/components/schemas/RecurrenceRule'
1722
- transactions:
1723
- type: array
1724
- items:
1725
- $ref: '#/components/schemas/Transaction'
1726
- responses:
1727
- '200':
1728
- description: Import completed successfully
1729
- content:
1730
- application/json:
1731
- schema:
1732
- type: object
1733
- properties:
1734
- message:
1735
- type: string
1736
- example: "Import completed successfully (mode: reset)"
1737
- '400':
1738
- description: Invalid input or unsupported version
1739
- '401':
1740
- $ref: '#/components/responses/UnauthorizedError'
1741
-
1742
- /settings:
1743
- post:
1744
- summary: Create global settings (only if not exists)
1745
- requestBody:
1746
- required: true
1747
- content:
1748
- application/json:
1749
- schema:
1750
- type: object
1751
- required:
1752
- - userName
1753
- - language
1754
- - currency
1755
- properties:
1756
- userName:
1757
- type: string
1758
- example: "John Doe"
1759
- language:
1760
- type: string
1761
- enum: [pt-BR, en-US]
1762
- example: "pt-BR"
1763
- currency:
1764
- type: string
1765
- enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1766
- example: "BRL"
1767
- responses:
1768
- '201':
1769
- description: Settings created successfully
1770
- content:
1771
- application/json:
1772
- schema:
1773
- $ref: '#/components/schemas/Settings'
1774
- '400':
1775
- description: Invalid input
1776
- '401':
1777
- $ref: '#/components/responses/UnauthorizedError'
1778
- '409':
1779
- description: Settings already exist
1780
-
1781
- get:
1782
- summary: Get global settings
1783
- responses:
1784
- '200':
1785
- description: Settings retrieved successfully
1786
- content:
1787
- application/json:
1788
- schema:
1789
- $ref: '#/components/schemas/Settings'
1790
- '401':
1791
- $ref: '#/components/responses/UnauthorizedError'
1792
- '404':
1793
- description: Settings not found
1794
-
1795
- put:
1796
- summary: Update global settings
1797
- requestBody:
1798
- required: true
1799
- content:
1800
- application/json:
1801
- schema:
1802
- type: object
1803
- properties:
1804
- userName:
1805
- type: string
1806
- example: "John Doe"
1807
- language:
1808
- type: string
1809
- enum: [pt-BR, en-US]
1810
- example: "pt-BR"
1811
- currency:
1812
- type: string
1813
- enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1814
- example: "BRL"
1815
- responses:
1816
- '200':
1817
- description: Settings updated successfully
1818
- content:
1819
- application/json:
1820
- schema:
1821
- $ref: '#/components/schemas/Settings'
1822
- '400':
1823
- description: Invalid input
1824
- '401':
1825
- $ref: '#/components/responses/UnauthorizedError'
1826
- '404':
1827
- description: Settings not found
1828
-
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
+ Transfer:
637
+ type: object
638
+ required:
639
+ - sourceAccountId
640
+ - destinationAccountId
641
+ - amount
642
+ - date
643
+ properties:
644
+ id:
645
+ type: string
646
+ description: Unique identifier for the transfer
647
+ example: "tr_123456789"
648
+ sourceAccountId:
649
+ type: string
650
+ description: ID of the account funds are transferred from
651
+ example: "acc_111111111"
652
+ destinationAccountId:
653
+ type: string
654
+ description: ID of the account funds are transferred to
655
+ example: "acc_222222222"
656
+ amount:
657
+ type: number
658
+ format: float
659
+ minimum: 0.01
660
+ description: Amount to transfer
661
+ example: 100.00
662
+ date:
663
+ type: string
664
+ format: date
665
+ description: Date of the transfer (YYYY-MM-DD)
666
+ example: "2026-02-17"
667
+ createdAt:
668
+ type: string
669
+ format: date-time
670
+ description: Timestamp when the transfer was created
671
+ example: "2026-02-17T10:00:00Z"
672
+ updatedAt:
673
+ type: string
674
+ format: date-time
675
+ description: Timestamp when the transfer was last updated
676
+ example: "2026-02-17T10:00:00Z"
677
+
678
+ responses:
679
+ UnauthorizedError:
680
+ description: API key is missing or invalid
681
+ content:
682
+ application/json:
683
+ schema:
684
+ type: object
685
+ properties:
686
+ statusCode:
687
+ type: integer
688
+ example: 401
689
+ error:
690
+ type: string
691
+ example: "Unauthorized"
692
+ message:
693
+ type: string
694
+ example: "Invalid API key"
695
+
696
+ security:
697
+ - ApiKeyAuth: []
698
+
699
+ paths:
700
+ /categories:
701
+ post:
702
+ summary: Create a new category
703
+ requestBody:
704
+ required: true
705
+ content:
706
+ application/json:
707
+ schema:
708
+ type: object
709
+ required:
710
+ - name
711
+ - type
712
+ properties:
713
+ name:
714
+ type: string
715
+ example: "Groceries"
716
+ type:
717
+ type: string
718
+ enum: [INCOME, EXPENSE]
719
+ example: "EXPENSE"
720
+ color:
721
+ type: string
722
+ nullable: true
723
+ pattern: "^#[0-9A-Fa-f]{6}$"
724
+ description: Color in hexadecimal format
725
+ example: "#FF5733"
726
+ responses:
727
+ '201':
728
+ description: Category created successfully
729
+ content:
730
+ application/json:
731
+ schema:
732
+ $ref: '#/components/schemas/Category'
733
+ '400':
734
+ description: Invalid input
735
+ '401':
736
+ $ref: '#/components/responses/UnauthorizedError'
737
+
738
+ get:
739
+ summary: Get all categories
740
+ responses:
741
+ '200':
742
+ description: List of categories
743
+ content:
744
+ application/json:
745
+ schema:
746
+ type: array
747
+ items:
748
+ $ref: '#/components/schemas/Category'
749
+ '401':
750
+ $ref: '#/components/responses/UnauthorizedError'
751
+
752
+ /categories/{id}:
753
+ get:
754
+ summary: Get a category by ID
755
+ parameters:
756
+ - name: id
757
+ in: path
758
+ required: true
759
+ schema:
760
+ type: string
761
+ description: Category ID
762
+ responses:
763
+ '200':
764
+ description: Category found
765
+ content:
766
+ application/json:
767
+ schema:
768
+ $ref: '#/components/schemas/Category'
769
+ '401':
770
+ $ref: '#/components/responses/UnauthorizedError'
771
+ '404':
772
+ description: Category not found
773
+
774
+ patch:
775
+ summary: Update a category
776
+ parameters:
777
+ - name: id
778
+ in: path
779
+ required: true
780
+ schema:
781
+ type: string
782
+ description: Category ID
783
+ requestBody:
784
+ required: true
785
+ content:
786
+ application/json:
787
+ schema:
788
+ type: object
789
+ properties:
790
+ name:
791
+ type: string
792
+ example: "Groceries"
793
+ color:
794
+ type: string
795
+ nullable: true
796
+ pattern: "^#[0-9A-Fa-f]{6}$"
797
+ description: Color in hexadecimal format
798
+ example: "#FF5733"
799
+ responses:
800
+ '200':
801
+ description: Category updated successfully
802
+ content:
803
+ application/json:
804
+ schema:
805
+ $ref: '#/components/schemas/Category'
806
+ '400':
807
+ description: Invalid input
808
+ '401':
809
+ $ref: '#/components/responses/UnauthorizedError'
810
+ '404':
811
+ description: Category not found
812
+
813
+ delete:
814
+ summary: Delete a category
815
+ parameters:
816
+ - name: id
817
+ in: path
818
+ required: true
819
+ schema:
820
+ type: string
821
+ description: Category ID
822
+ responses:
823
+ '200':
824
+ description: Category deleted successfully
825
+ '401':
826
+ $ref: '#/components/responses/UnauthorizedError'
827
+ '404':
828
+ description: Category not found
829
+
830
+ /credit-cards:
831
+ post:
832
+ summary: Create a new credit card
833
+ requestBody:
834
+ required: true
835
+ content:
836
+ application/json:
837
+ schema:
838
+ type: object
839
+ required:
840
+ - name
841
+ - limitAmount
842
+ - closingDay
843
+ - dueDay
844
+ properties:
845
+ name:
846
+ type: string
847
+ example: "Nubank Platinum"
848
+ brand:
849
+ type: string
850
+ example: "Visa"
851
+ limitAmount:
852
+ type: number
853
+ format: float
854
+ example: 5000.00
855
+ closingDay:
856
+ type: integer
857
+ minimum: 1
858
+ maximum: 31
859
+ example: 15
860
+ dueDay:
861
+ type: integer
862
+ minimum: 1
863
+ maximum: 31
864
+ example: 22
865
+ responses:
866
+ '201':
867
+ description: Credit card created successfully
868
+ content:
869
+ application/json:
870
+ schema:
871
+ $ref: '#/components/schemas/CreditCard'
872
+ '400':
873
+ description: Invalid input
874
+ '401':
875
+ $ref: '#/components/responses/UnauthorizedError'
876
+
877
+ get:
878
+ summary: Get all credit cards
879
+ responses:
880
+ '200':
881
+ description: List of credit cards
882
+ content:
883
+ application/json:
884
+ schema:
885
+ type: array
886
+ items:
887
+ $ref: '#/components/schemas/CreditCard'
888
+ '401':
889
+ $ref: '#/components/responses/UnauthorizedError'
890
+
891
+ /credit-cards/{id}:
892
+ get:
893
+ summary: Get a credit card by ID
894
+ parameters:
895
+ - name: id
896
+ in: path
897
+ required: true
898
+ schema:
899
+ type: string
900
+ description: Credit card ID
901
+ responses:
902
+ '200':
903
+ description: Credit card found
904
+ content:
905
+ application/json:
906
+ schema:
907
+ $ref: '#/components/schemas/CreditCard'
908
+ '401':
909
+ $ref: '#/components/responses/UnauthorizedError'
910
+ '404':
911
+ description: Credit card not found
912
+
913
+ patch:
914
+ summary: Update a credit card
915
+ parameters:
916
+ - name: id
917
+ in: path
918
+ required: true
919
+ schema:
920
+ type: string
921
+ description: Credit card ID
922
+ requestBody:
923
+ required: true
924
+ content:
925
+ application/json:
926
+ schema:
927
+ type: object
928
+ properties:
929
+ name:
930
+ type: string
931
+ example: "Nubank Platinum"
932
+ brand:
933
+ type: string
934
+ example: "Visa"
935
+ limitAmount:
936
+ type: number
937
+ format: float
938
+ example: 5000.00
939
+ closingDay:
940
+ type: integer
941
+ minimum: 1
942
+ maximum: 31
943
+ example: 15
944
+ dueDay:
945
+ type: integer
946
+ minimum: 1
947
+ maximum: 31
948
+ example: 22
949
+ responses:
950
+ '200':
951
+ description: Credit card updated successfully
952
+ content:
953
+ application/json:
954
+ schema:
955
+ $ref: '#/components/schemas/CreditCard'
956
+ '400':
957
+ description: Invalid input
958
+ '401':
959
+ $ref: '#/components/responses/UnauthorizedError'
960
+ '404':
961
+ description: Credit card not found
962
+
963
+ delete:
964
+ summary: Delete a credit card
965
+ parameters:
966
+ - name: id
967
+ in: path
968
+ required: true
969
+ schema:
970
+ type: string
971
+ description: Credit card ID
972
+ responses:
973
+ '200':
974
+ description: Credit card deleted successfully
975
+ '400':
976
+ description: Cannot delete credit card with associated transactions
977
+ '401':
978
+ $ref: '#/components/responses/UnauthorizedError'
979
+ '404':
980
+ description: Credit card not found
981
+
982
+ /credit-cards/{id}/statement:
983
+ get:
984
+ summary: Get credit card statement for a specific month
985
+ parameters:
986
+ - name: id
987
+ in: path
988
+ required: true
989
+ schema:
990
+ type: string
991
+ description: Credit card ID
992
+ - name: month
993
+ in: query
994
+ required: true
995
+ schema:
996
+ type: string
997
+ pattern: "^\\d{4}-\\d{2}$"
998
+ description: Month in YYYY-MM format
999
+ example: "2026-03"
1000
+ responses:
1001
+ '200':
1002
+ description: Credit card statement
1003
+ content:
1004
+ application/json:
1005
+ schema:
1006
+ $ref: '#/components/schemas/Statement'
1007
+ '401':
1008
+ $ref: '#/components/responses/UnauthorizedError'
1009
+ '404':
1010
+ description: Credit card not found
1011
+
1012
+ /credit-cards/{id}/pay-statement:
1013
+ post:
1014
+ summary: Mark all transactions in a credit card statement as paid
1015
+ parameters:
1016
+ - name: id
1017
+ in: path
1018
+ required: true
1019
+ schema:
1020
+ type: string
1021
+ description: Credit card ID
1022
+ requestBody:
1023
+ required: true
1024
+ content:
1025
+ application/json:
1026
+ schema:
1027
+ type: object
1028
+ required:
1029
+ - month
1030
+ - paymentAccountId
1031
+ properties:
1032
+ month:
1033
+ type: string
1034
+ pattern: "^\\d{4}-\\d{2}$"
1035
+ description: Month in YYYY-MM format
1036
+ example: "2026-03"
1037
+ paymentAccountId:
1038
+ type: string
1039
+ description: ID of the account to debit for the payment
1040
+ example: "acc_123456789"
1041
+ responses:
1042
+ '200':
1043
+ description: Statement marked as paid
1044
+ content:
1045
+ application/json:
1046
+ schema:
1047
+ type: object
1048
+ properties:
1049
+ message:
1050
+ type: string
1051
+ example: "Statement for March 2026 marked as paid and linked to account acc_123456789"
1052
+ '400':
1053
+ description: Invalid input or statement is already paid
1054
+ '401':
1055
+ $ref: '#/components/responses/UnauthorizedError'
1056
+ '404':
1057
+ description: Credit card not found
1058
+
1059
+ /credit-cards/{id}/reopen-statement:
1060
+ post:
1061
+ summary: Reopen a credit card statement by marking all transactions as unpaid
1062
+ parameters:
1063
+ - name: id
1064
+ in: path
1065
+ required: true
1066
+ schema:
1067
+ type: string
1068
+ description: Credit card ID
1069
+ requestBody:
1070
+ required: true
1071
+ content:
1072
+ application/json:
1073
+ schema:
1074
+ type: object
1075
+ required:
1076
+ - month
1077
+ properties:
1078
+ month:
1079
+ type: string
1080
+ pattern: "^\\d{4}-\\d{2}$"
1081
+ description: Month in YYYY-MM format
1082
+ example: "2026-03"
1083
+ responses:
1084
+ '200':
1085
+ description: Statement reopened successfully
1086
+ content:
1087
+ application/json:
1088
+ schema:
1089
+ type: object
1090
+ properties:
1091
+ message:
1092
+ type: string
1093
+ example: "Statement for 2026-03 successfully reopened. 5 transaction(s) marked as unpaid."
1094
+ '400':
1095
+ description: Invalid input or statement is already open
1096
+ '401':
1097
+ $ref: '#/components/responses/UnauthorizedError'
1098
+ '404':
1099
+ description: Credit card not found
1100
+
1101
+ /credit-cards/{id}/statement-status:
1102
+ get:
1103
+ summary: Get credit card statement payment status for a specific month
1104
+ parameters:
1105
+ - name: id
1106
+ in: path
1107
+ required: true
1108
+ schema:
1109
+ type: string
1110
+ description: Credit card ID
1111
+ - name: month
1112
+ in: query
1113
+ required: true
1114
+ schema:
1115
+ type: string
1116
+ pattern: "^\\d{4}-\\d{2}$"
1117
+ description: Month in YYYY-MM format
1118
+ example: "2026-03"
1119
+ responses:
1120
+ '200':
1121
+ description: Credit card statement status
1122
+ content:
1123
+ application/json:
1124
+ schema:
1125
+ $ref: '#/components/schemas/StatementStatus'
1126
+ '401':
1127
+ $ref: '#/components/responses/UnauthorizedError'
1128
+ '404':
1129
+ description: Credit card not found
1130
+
1131
+ /transactions:
1132
+ post:
1133
+ summary: Create a new transaction
1134
+ requestBody:
1135
+ required: true
1136
+ content:
1137
+ application/json:
1138
+ schema:
1139
+ type: object
1140
+ required:
1141
+ - type
1142
+ - name
1143
+ - amount
1144
+ - date
1145
+ properties:
1146
+ type:
1147
+ $ref: '#/components/schemas/Transaction/properties/type'
1148
+ name:
1149
+ $ref: '#/components/schemas/Transaction/properties/name'
1150
+ amount:
1151
+ $ref: '#/components/schemas/Transaction/properties/amount'
1152
+ date:
1153
+ $ref: '#/components/schemas/Transaction/properties/date'
1154
+ categoryId:
1155
+ $ref: '#/components/schemas/Transaction/properties/categoryId'
1156
+ paymentMethod:
1157
+ $ref: '#/components/schemas/Transaction/properties/paymentMethod'
1158
+ creditCardId:
1159
+ $ref: '#/components/schemas/Transaction/properties/creditCardId'
1160
+ accountId:
1161
+ type: string
1162
+ description: ID of the associated account (required if paymentMethod is not CREDIT)
1163
+ example: "acc_123456789"
1164
+ installments:
1165
+ type: integer
1166
+ minimum: 1
1167
+ description: Number of installments (optional)
1168
+ example: 3
1169
+ targetDueMonth:
1170
+ type: string
1171
+ pattern: "^\\d{4}-\\d{2}$"
1172
+ description: Target month for due date in YYYY-MM format (optional)
1173
+ example: "2026-03"
1174
+ purchaseDate:
1175
+ type: string
1176
+ format: date
1177
+ description: Actual purchase date (credit card only, optional)
1178
+ example: "2026-02-10"
1179
+ recurrence:
1180
+ type: object
1181
+ properties:
1182
+ frequency:
1183
+ $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
1184
+ interval:
1185
+ $ref: '#/components/schemas/RecurrenceRule/properties/interval'
1186
+ endDate:
1187
+ $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
1188
+ occurrences:
1189
+ $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
1190
+ responses:
1191
+ '201':
1192
+ description: Transaction created successfully
1193
+ content:
1194
+ application/json:
1195
+ schema:
1196
+ $ref: '#/components/schemas/Transaction'
1197
+ '400':
1198
+ description: Invalid input or target statement is already closed (paid)
1199
+ '401':
1200
+ $ref: '#/components/responses/UnauthorizedError'
1201
+
1202
+ get:
1203
+ summary: Get all transactions
1204
+ parameters:
1205
+ - name: month
1206
+ in: query
1207
+ required: false
1208
+ schema:
1209
+ type: string
1210
+ pattern: "^\\d{4}-\\d{2}$"
1211
+ description: Filter transactions by month (YYYY-MM format)
1212
+ example: "2026-03"
1213
+ - name: accountId
1214
+ in: query
1215
+ required: false
1216
+ schema:
1217
+ type: string
1218
+ description: Filter transactions by account ID
1219
+ example: "acc_123456789"
1220
+ - name: categoryId
1221
+ in: query
1222
+ required: false
1223
+ schema:
1224
+ type: string
1225
+ description: Filter transactions by category ID
1226
+ example: "cat_123456789"
1227
+ - name: creditCardId
1228
+ in: query
1229
+ required: false
1230
+ schema:
1231
+ type: string
1232
+ description: Filter transactions by credit card ID
1233
+ example: "cc_123456789"
1234
+ - name: type
1235
+ in: query
1236
+ required: false
1237
+ schema:
1238
+ type: string
1239
+ enum: [INCOME, EXPENSE]
1240
+ description: Filter transactions by type
1241
+ example: "EXPENSE"
1242
+ - name: startDate
1243
+ in: query
1244
+ required: false
1245
+ schema:
1246
+ type: string
1247
+ format: date
1248
+ description: Filter transactions starting from this date (inclusive)
1249
+ example: "2026-01-01"
1250
+ - name: endDate
1251
+ in: query
1252
+ required: false
1253
+ schema:
1254
+ type: string
1255
+ format: date
1256
+ description: Filter transactions up to this date (inclusive)
1257
+ example: "2026-01-31"
1258
+ - name: paid
1259
+ in: query
1260
+ required: false
1261
+ schema:
1262
+ type: boolean
1263
+ description: Filter by payment status (true = paid, false = unpaid)
1264
+ example: false
1265
+ responses:
1266
+ '200':
1267
+ description: List of transactions
1268
+ content:
1269
+ application/json:
1270
+ schema:
1271
+ type: array
1272
+ items:
1273
+ $ref: '#/components/schemas/Transaction'
1274
+ '401':
1275
+ $ref: '#/components/responses/UnauthorizedError'
1276
+
1277
+ /transactions/{id}/pay:
1278
+ patch:
1279
+ summary: Mark a transaction as paid/received
1280
+ description: |
1281
+ Marks a transaction as paid or received.
1282
+ **Note:** Credit card transactions cannot be marked as paid directly. They are automatically
1283
+ marked as paid when the credit card statement is paid via the `POST /credit-cards/{id}/pay-statement` endpoint.
1284
+ parameters:
1285
+ - name: id
1286
+ in: path
1287
+ required: true
1288
+ schema:
1289
+ type: string
1290
+ description: Transaction ID
1291
+ responses:
1292
+ '200':
1293
+ description: Transaction marked as paid
1294
+ content:
1295
+ application/json:
1296
+ schema:
1297
+ $ref: '#/components/schemas/Transaction'
1298
+ '400':
1299
+ description: Cannot mark credit card transaction as paid directly
1300
+ '401':
1301
+ $ref: '#/components/responses/UnauthorizedError'
1302
+ '404':
1303
+ description: Transaction not found
1304
+
1305
+ /transactions/{id}/unpay:
1306
+ patch:
1307
+ summary: Mark a transaction as unpaid
1308
+ parameters:
1309
+ - name: id
1310
+ in: path
1311
+ required: true
1312
+ schema:
1313
+ type: string
1314
+ description: Transaction ID
1315
+ responses:
1316
+ '200':
1317
+ description: Transaction marked as unpaid
1318
+ content:
1319
+ application/json:
1320
+ schema:
1321
+ $ref: '#/components/schemas/Transaction'
1322
+ '404':
1323
+ description: Transaction not found
1324
+ '401':
1325
+ $ref: '#/components/responses/UnauthorizedError'
1326
+
1327
+ /transactions/{id}:
1328
+ get:
1329
+ summary: Get a transaction by ID
1330
+ parameters:
1331
+ - name: id
1332
+ in: path
1333
+ required: true
1334
+ schema:
1335
+ type: string
1336
+ description: Transaction ID
1337
+ responses:
1338
+ '200':
1339
+ description: Transaction found
1340
+ content:
1341
+ application/json:
1342
+ schema:
1343
+ $ref: '#/components/schemas/Transaction'
1344
+ '401':
1345
+ $ref: '#/components/responses/UnauthorizedError'
1346
+ '404':
1347
+ description: Transaction not found
1348
+
1349
+ patch:
1350
+ summary: Update a transaction
1351
+ description: |
1352
+ Update a transaction.
1353
+ **Note:** Transactions that have already been paid cannot be edited.
1354
+ For credit card transactions, you can use targetDueMonth to automatically calculate the date based on the credit card's due day.
1355
+
1356
+ **Recurring Transactions - Editable Fields by Mode:**
1357
+ - **SINGLE**: Can edit `name`, `categoryId`, `date`, `targetDueMonth`, `amount`
1358
+ - **PENDING/ALL**: Can edit `name`, `categoryId`, `amount`, `paymentMethod`, `accountId`, `creditCardId` (date and type are restricted to prevent desynchronization)
1359
+
1360
+ **Installment Transactions - Editable Fields by Mode:**
1361
+ - **PENDING/ALL**: Only `name`, `categoryId`, and `amount` are propagated to other installments. All other fields are ignored for the bulk update.
1362
+ parameters:
1363
+ - name: id
1364
+ in: path
1365
+ required: true
1366
+ schema:
1367
+ type: string
1368
+ description: Transaction ID
1369
+ - name: mode
1370
+ in: query
1371
+ required: false
1372
+ schema:
1373
+ type: string
1374
+ enum: [SINGLE, PENDING, ALL]
1375
+ default: SINGLE
1376
+ description: |
1377
+ Update mode for recurring or installment transactions:
1378
+ - **SINGLE**: Update only this specific transaction (default)
1379
+ - **PENDING**: Update this transaction and all future unpaid transactions in the same recurrence series or installment group
1380
+ - **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)
1381
+
1382
+ If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1383
+ example: SINGLE
1384
+ requestBody:
1385
+ required: true
1386
+ content:
1387
+ application/json:
1388
+ schema:
1389
+ $ref: '#/components/schemas/UpdateTransactionRequest'
1390
+ responses:
1391
+ '200':
1392
+ description: Transaction updated successfully
1393
+ content:
1394
+ application/json:
1395
+ schema:
1396
+ $ref: '#/components/schemas/Transaction'
1397
+ '400':
1398
+ description: Invalid input or transaction is already paid
1399
+ '401':
1400
+ $ref: '#/components/responses/UnauthorizedError'
1401
+ '404':
1402
+ description: Transaction not found
1403
+
1404
+ delete:
1405
+ summary: Delete a transaction
1406
+ parameters:
1407
+ - name: id
1408
+ in: path
1409
+ required: true
1410
+ schema:
1411
+ type: string
1412
+ description: Transaction ID
1413
+ - name: mode
1414
+ in: query
1415
+ required: false
1416
+ schema:
1417
+ type: string
1418
+ enum: [SINGLE, PENDING, ALL]
1419
+ default: SINGLE
1420
+ description: |
1421
+ Deletion mode for recurring or installment transactions:
1422
+ - **SINGLE**: Delete only this specific transaction (default)
1423
+ - **PENDING**: Delete this transaction and all future unpaid transactions in the same recurrence series or installment group
1424
+ - **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)
1425
+
1426
+ If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1427
+ example: SINGLE
1428
+ responses:
1429
+ '200':
1430
+ description: Transaction deleted successfully
1431
+ '401':
1432
+ $ref: '#/components/responses/UnauthorizedError'
1433
+ '404':
1434
+ description: Transaction not found
1435
+
1436
+ /summary:
1437
+ get:
1438
+ summary: Get financial summary
1439
+ description: >
1440
+ Returns income, expenses, balance, credit card totals, and category breakdowns.
1441
+ Provide either `month` (YYYY-MM) or both `startDate` and `endDate` (YYYY-MM-DD).
1442
+ parameters:
1443
+ - name: month
1444
+ in: query
1445
+ required: false
1446
+ schema:
1447
+ type: string
1448
+ pattern: "^\\d{4}-\\d{2}$"
1449
+ description: Month in YYYY-MM format
1450
+ example: "2026-02"
1451
+ - name: startDate
1452
+ in: query
1453
+ required: false
1454
+ schema:
1455
+ type: string
1456
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1457
+ description: Start date in YYYY-MM-DD format (use with endDate for a custom range)
1458
+ example: "2026-01-01"
1459
+ - name: endDate
1460
+ in: query
1461
+ required: false
1462
+ schema:
1463
+ type: string
1464
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1465
+ description: End date in YYYY-MM-DD format (use with startDate for a custom range)
1466
+ example: "2026-03-31"
1467
+ responses:
1468
+ '200':
1469
+ description: Financial summary for the given period
1470
+ content:
1471
+ application/json:
1472
+ schema:
1473
+ $ref: '#/components/schemas/Summary'
1474
+ '400':
1475
+ description: Invalid or missing period parameters
1476
+ '401':
1477
+ $ref: '#/components/responses/UnauthorizedError'
1478
+
1479
+ /accounts:
1480
+ post:
1481
+ summary: Create a new account
1482
+ requestBody:
1483
+ required: true
1484
+ content:
1485
+ application/json:
1486
+ schema:
1487
+ type: object
1488
+ required:
1489
+ - name
1490
+ - type
1491
+ properties:
1492
+ name:
1493
+ type: string
1494
+ description: Name of the account
1495
+ example: "Itaú Checking Account"
1496
+ type:
1497
+ type: string
1498
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1499
+ description: Type of account
1500
+ example: "BANK_ACCOUNT"
1501
+ initialBalance:
1502
+ type: number
1503
+ format: float
1504
+ description: Initial balance for the account
1505
+ example: 1000.00
1506
+ responses:
1507
+ '201':
1508
+ description: Account created successfully
1509
+ content:
1510
+ application/json:
1511
+ schema:
1512
+ $ref: '#/components/schemas/Account'
1513
+ '400':
1514
+ description: Invalid input
1515
+ '401':
1516
+ $ref: '#/components/responses/UnauthorizedError'
1517
+
1518
+ get:
1519
+ summary: Get all accounts
1520
+ responses:
1521
+ '200':
1522
+ description: List of accounts with current balances
1523
+ content:
1524
+ application/json:
1525
+ schema:
1526
+ type: array
1527
+ items:
1528
+ $ref: '#/components/schemas/Account'
1529
+ '401':
1530
+ $ref: '#/components/responses/UnauthorizedError'
1531
+
1532
+ /accounts/{id}:
1533
+ get:
1534
+ summary: Get a specific account
1535
+ parameters:
1536
+ - name: id
1537
+ in: path
1538
+ required: true
1539
+ schema:
1540
+ type: string
1541
+ description: Account ID
1542
+ responses:
1543
+ '200':
1544
+ description: Account details
1545
+ content:
1546
+ application/json:
1547
+ schema:
1548
+ $ref: '#/components/schemas/Account'
1549
+ '401':
1550
+ $ref: '#/components/responses/UnauthorizedError'
1551
+ '404':
1552
+ description: Account not found
1553
+
1554
+ patch:
1555
+ summary: Update an account
1556
+ parameters:
1557
+ - name: id
1558
+ in: path
1559
+ required: true
1560
+ schema:
1561
+ type: string
1562
+ description: Account ID
1563
+ requestBody:
1564
+ required: true
1565
+ content:
1566
+ application/json:
1567
+ schema:
1568
+ type: object
1569
+ properties:
1570
+ name:
1571
+ type: string
1572
+ description: Name of the account
1573
+ example: "Itaú Savings Account"
1574
+ type:
1575
+ type: string
1576
+ enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1577
+ description: Type of account
1578
+ example: "SAVINGS_ACCOUNT"
1579
+ responses:
1580
+ '200':
1581
+ description: Account updated successfully
1582
+ content:
1583
+ application/json:
1584
+ schema:
1585
+ $ref: '#/components/schemas/Account'
1586
+ '400':
1587
+ description: Invalid input
1588
+ '401':
1589
+ $ref: '#/components/responses/UnauthorizedError'
1590
+ '404':
1591
+ description: Account not found
1592
+
1593
+ delete:
1594
+ summary: Delete an account
1595
+ parameters:
1596
+ - name: id
1597
+ in: path
1598
+ required: true
1599
+ schema:
1600
+ type: string
1601
+ description: Account ID
1602
+ responses:
1603
+ '204':
1604
+ description: Account deleted successfully
1605
+ '401':
1606
+ $ref: '#/components/responses/UnauthorizedError'
1607
+ '404':
1608
+ description: Account not found
1609
+ '409':
1610
+ description: Cannot delete account with associated transactions
1611
+
1612
+ /accounts/{id}/balance:
1613
+ get:
1614
+ summary: Get the current balance for an account
1615
+ parameters:
1616
+ - name: id
1617
+ in: path
1618
+ required: true
1619
+ schema:
1620
+ type: string
1621
+ description: Account ID
1622
+ responses:
1623
+ '200':
1624
+ description: Account balance
1625
+ content:
1626
+ application/json:
1627
+ schema:
1628
+ $ref: '#/components/schemas/AccountBalance'
1629
+ '401':
1630
+ $ref: '#/components/responses/UnauthorizedError'
1631
+ '404':
1632
+ description: Account not found
1633
+
1634
+ /accounts/{id}/transactions:
1635
+ get:
1636
+ summary: Get all transactions linked to an account
1637
+ parameters:
1638
+ - name: id
1639
+ in: path
1640
+ required: true
1641
+ schema:
1642
+ type: string
1643
+ description: Account ID
1644
+ responses:
1645
+ '200':
1646
+ description: List of transactions linked to the account
1647
+ content:
1648
+ application/json:
1649
+ schema:
1650
+ type: array
1651
+ items:
1652
+ $ref: '#/components/schemas/Transaction'
1653
+ '401':
1654
+ $ref: '#/components/responses/UnauthorizedError'
1655
+ '404':
1656
+ description: Account not found
1657
+
1658
+ /export:
1659
+ get:
1660
+ summary: Export all user data
1661
+ description: Returns a complete backup of all user data including settings, categories, accounts, credit cards, recurrence rules, and transactions.
1662
+ security:
1663
+ - ApiKeyAuth: []
1664
+ responses:
1665
+ '200':
1666
+ description: Export payload with all data
1667
+ content:
1668
+ application/json:
1669
+ schema:
1670
+ type: object
1671
+ properties:
1672
+ version:
1673
+ type: string
1674
+ example: "1.0"
1675
+ exportedAt:
1676
+ type: string
1677
+ format: date-time
1678
+ example: "2026-02-14T21:00:00.000Z"
1679
+ data:
1680
+ type: object
1681
+ properties:
1682
+ settings:
1683
+ nullable: true
1684
+ $ref: '#/components/schemas/Settings'
1685
+ categories:
1686
+ type: array
1687
+ items:
1688
+ $ref: '#/components/schemas/Category'
1689
+ accounts:
1690
+ type: array
1691
+ items:
1692
+ $ref: '#/components/schemas/Account'
1693
+ creditCards:
1694
+ type: array
1695
+ items:
1696
+ $ref: '#/components/schemas/CreditCard'
1697
+ recurrenceRules:
1698
+ type: array
1699
+ items:
1700
+ $ref: '#/components/schemas/RecurrenceRule'
1701
+ transactions:
1702
+ type: array
1703
+ items:
1704
+ $ref: '#/components/schemas/Transaction'
1705
+ '401':
1706
+ $ref: '#/components/responses/UnauthorizedError'
1707
+
1708
+ /import:
1709
+ post:
1710
+ summary: Import user data
1711
+ description: |
1712
+ Imports a previously exported backup. Supports two modes:
1713
+ - **reset**: Clears all existing data and replaces it with the imported data.
1714
+ - **increment**: Adds new records from the import, ignoring records whose IDs already exist.
1715
+ security:
1716
+ - ApiKeyAuth: []
1717
+ requestBody:
1718
+ required: true
1719
+ content:
1720
+ application/json:
1721
+ schema:
1722
+ type: object
1723
+ required:
1724
+ - mode
1725
+ - version
1726
+ - exportedAt
1727
+ - data
1728
+ properties:
1729
+ mode:
1730
+ type: string
1731
+ enum: [reset, increment]
1732
+ description: Import mode
1733
+ example: "reset"
1734
+ version:
1735
+ type: string
1736
+ description: Export format version. Must be "1.0".
1737
+ example: "1.0"
1738
+ exportedAt:
1739
+ type: string
1740
+ format: date-time
1741
+ example: "2026-02-14T21:00:00.000Z"
1742
+ data:
1743
+ type: object
1744
+ properties:
1745
+ settings:
1746
+ nullable: true
1747
+ $ref: '#/components/schemas/Settings'
1748
+ categories:
1749
+ type: array
1750
+ items:
1751
+ $ref: '#/components/schemas/Category'
1752
+ accounts:
1753
+ type: array
1754
+ items:
1755
+ $ref: '#/components/schemas/Account'
1756
+ creditCards:
1757
+ type: array
1758
+ items:
1759
+ $ref: '#/components/schemas/CreditCard'
1760
+ recurrenceRules:
1761
+ type: array
1762
+ items:
1763
+ $ref: '#/components/schemas/RecurrenceRule'
1764
+ transactions:
1765
+ type: array
1766
+ items:
1767
+ $ref: '#/components/schemas/Transaction'
1768
+ responses:
1769
+ '200':
1770
+ description: Import completed successfully
1771
+ content:
1772
+ application/json:
1773
+ schema:
1774
+ type: object
1775
+ properties:
1776
+ message:
1777
+ type: string
1778
+ example: "Import completed successfully (mode: reset)"
1779
+ '400':
1780
+ description: Invalid input or unsupported version
1781
+ '401':
1782
+ $ref: '#/components/responses/UnauthorizedError'
1783
+
1784
+ /settings:
1785
+ post:
1786
+ summary: Create global settings (only if not exists)
1787
+ requestBody:
1788
+ required: true
1789
+ content:
1790
+ application/json:
1791
+ schema:
1792
+ type: object
1793
+ required:
1794
+ - userName
1795
+ - language
1796
+ - currency
1797
+ properties:
1798
+ userName:
1799
+ type: string
1800
+ example: "John Doe"
1801
+ language:
1802
+ type: string
1803
+ enum: [pt-BR, en-US]
1804
+ example: "pt-BR"
1805
+ currency:
1806
+ type: string
1807
+ enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1808
+ example: "BRL"
1809
+ responses:
1810
+ '201':
1811
+ description: Settings created successfully
1812
+ content:
1813
+ application/json:
1814
+ schema:
1815
+ $ref: '#/components/schemas/Settings'
1816
+ '400':
1817
+ description: Invalid input
1818
+ '401':
1819
+ $ref: '#/components/responses/UnauthorizedError'
1820
+ '409':
1821
+ description: Settings already exist
1822
+
1823
+ get:
1824
+ summary: Get global settings
1825
+ responses:
1826
+ '200':
1827
+ description: Settings retrieved successfully
1828
+ content:
1829
+ application/json:
1830
+ schema:
1831
+ $ref: '#/components/schemas/Settings'
1832
+ '401':
1833
+ $ref: '#/components/responses/UnauthorizedError'
1834
+ '404':
1835
+ description: Settings not found
1836
+
1837
+ put:
1838
+ summary: Update global settings
1839
+ requestBody:
1840
+ required: true
1841
+ content:
1842
+ application/json:
1843
+ schema:
1844
+ type: object
1845
+ properties:
1846
+ userName:
1847
+ type: string
1848
+ example: "John Doe"
1849
+ language:
1850
+ type: string
1851
+ enum: [pt-BR, en-US]
1852
+ example: "pt-BR"
1853
+ currency:
1854
+ type: string
1855
+ enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1856
+ example: "BRL"
1857
+ responses:
1858
+ '200':
1859
+ description: Settings updated successfully
1860
+ content:
1861
+ application/json:
1862
+ schema:
1863
+ $ref: '#/components/schemas/Settings'
1864
+ '400':
1865
+ description: Invalid input
1866
+ '401':
1867
+ $ref: '#/components/responses/UnauthorizedError'
1868
+ '404':
1869
+ description: Settings not found
1870
+
1871
+ /transfers:
1872
+ post:
1873
+ tags:
1874
+ - transfers
1875
+ summary: Create a new transfer between accounts
1876
+ security:
1877
+ - ApiKeyAuth: []
1878
+ requestBody:
1879
+ required: true
1880
+ content:
1881
+ application/json:
1882
+ schema:
1883
+ type: object
1884
+ required:
1885
+ - sourceAccountId
1886
+ - destinationAccountId
1887
+ - amount
1888
+ - date
1889
+ properties:
1890
+ sourceAccountId:
1891
+ type: string
1892
+ destinationAccountId:
1893
+ type: string
1894
+ amount:
1895
+ type: number
1896
+ minimum: 0.01
1897
+ date:
1898
+ type: string
1899
+ format: date
1900
+ responses:
1901
+ '201':
1902
+ description: Transfer created successfully
1903
+ content:
1904
+ application/json:
1905
+ schema:
1906
+ $ref: '#/components/schemas/Transfer'
1907
+ '400':
1908
+ description: Invalid input
1909
+ '401':
1910
+ $ref: '#/components/responses/UnauthorizedError'
1911
+ '404':
1912
+ description: Account not found
1913
+ get:
1914
+ tags:
1915
+ - transfers
1916
+ summary: List transfers with optional filters
1917
+ security:
1918
+ - ApiKeyAuth: []
1919
+ parameters:
1920
+ - name: accountId
1921
+ in: query
1922
+ required: false
1923
+ description: Filter by account ID (source or destination)
1924
+ schema:
1925
+ type: string
1926
+ - name: month
1927
+ in: query
1928
+ required: false
1929
+ description: Filter by month (YYYY-MM format)
1930
+ schema:
1931
+ type: string
1932
+ pattern: '^\d{4}-\d{2}$'
1933
+ example: "2026-02"
1934
+ - name: startDate
1935
+ in: query
1936
+ required: false
1937
+ description: Filter from date (YYYY-MM-DD)
1938
+ schema:
1939
+ type: string
1940
+ format: date
1941
+ - name: endDate
1942
+ in: query
1943
+ required: false
1944
+ description: Filter to date (YYYY-MM-DD)
1945
+ schema:
1946
+ type: string
1947
+ format: date
1948
+ responses:
1949
+ '200':
1950
+ description: List of transfers
1951
+ content:
1952
+ application/json:
1953
+ schema:
1954
+ type: array
1955
+ items:
1956
+ $ref: '#/components/schemas/Transfer'
1957
+ '401':
1958
+ $ref: '#/components/responses/UnauthorizedError'
1959
+
1960
+ /transfers/{id}:
1961
+ get:
1962
+ tags:
1963
+ - transfers
1964
+ summary: Get a transfer by ID
1965
+ security:
1966
+ - ApiKeyAuth: []
1967
+ parameters:
1968
+ - name: id
1969
+ in: path
1970
+ required: true
1971
+ schema:
1972
+ type: string
1973
+ responses:
1974
+ '200':
1975
+ description: Transfer retrieved successfully
1976
+ content:
1977
+ application/json:
1978
+ schema:
1979
+ $ref: '#/components/schemas/Transfer'
1980
+ '401':
1981
+ $ref: '#/components/responses/UnauthorizedError'
1982
+ '404':
1983
+ description: Transfer not found
1984
+ patch:
1985
+ tags:
1986
+ - transfers
1987
+ summary: Update a transfer
1988
+ security:
1989
+ - ApiKeyAuth: []
1990
+ parameters:
1991
+ - name: id
1992
+ in: path
1993
+ required: true
1994
+ schema:
1995
+ type: string
1996
+ requestBody:
1997
+ required: true
1998
+ content:
1999
+ application/json:
2000
+ schema:
2001
+ type: object
2002
+ properties:
2003
+ sourceAccountId:
2004
+ type: string
2005
+ destinationAccountId:
2006
+ type: string
2007
+ amount:
2008
+ type: number
2009
+ minimum: 0.01
2010
+ date:
2011
+ type: string
2012
+ format: date
2013
+ responses:
2014
+ '200':
2015
+ description: Transfer updated successfully
2016
+ content:
2017
+ application/json:
2018
+ schema:
2019
+ $ref: '#/components/schemas/Transfer'
2020
+ '400':
2021
+ description: Invalid input
2022
+ '401':
2023
+ $ref: '#/components/responses/UnauthorizedError'
2024
+ '404':
2025
+ description: Transfer not found
2026
+ delete:
2027
+ tags:
2028
+ - transfers
2029
+ summary: Delete a transfer
2030
+ security:
2031
+ - ApiKeyAuth: []
2032
+ parameters:
2033
+ - name: id
2034
+ in: path
2035
+ required: true
2036
+ schema:
2037
+ type: string
2038
+ responses:
2039
+ '204':
2040
+ description: Transfer deleted successfully
2041
+ '401':
2042
+ $ref: '#/components/responses/UnauthorizedError'
2043
+ '404':
2044
+ description: Transfer not found
2045
+