quantix-mcp 0.3.6 → 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 -1786
  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 -132
  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 -230
  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,1786 +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}/statement-status:
1018
- get:
1019
- summary: Get credit card statement payment status for a specific month
1020
- parameters:
1021
- - name: id
1022
- in: path
1023
- required: true
1024
- schema:
1025
- type: string
1026
- description: Credit card ID
1027
- - name: month
1028
- in: query
1029
- required: true
1030
- schema:
1031
- type: string
1032
- pattern: "^\\d{4}-\\d{2}$"
1033
- description: Month in YYYY-MM format
1034
- example: "2026-03"
1035
- responses:
1036
- '200':
1037
- description: Credit card statement status
1038
- content:
1039
- application/json:
1040
- schema:
1041
- $ref: '#/components/schemas/StatementStatus'
1042
- '401':
1043
- $ref: '#/components/responses/UnauthorizedError'
1044
- '404':
1045
- description: Credit card not found
1046
-
1047
- /transactions:
1048
- post:
1049
- summary: Create a new transaction
1050
- requestBody:
1051
- required: true
1052
- content:
1053
- application/json:
1054
- schema:
1055
- type: object
1056
- required:
1057
- - type
1058
- - name
1059
- - amount
1060
- - date
1061
- properties:
1062
- type:
1063
- $ref: '#/components/schemas/Transaction/properties/type'
1064
- name:
1065
- $ref: '#/components/schemas/Transaction/properties/name'
1066
- amount:
1067
- $ref: '#/components/schemas/Transaction/properties/amount'
1068
- date:
1069
- $ref: '#/components/schemas/Transaction/properties/date'
1070
- categoryId:
1071
- $ref: '#/components/schemas/Transaction/properties/categoryId'
1072
- paymentMethod:
1073
- $ref: '#/components/schemas/Transaction/properties/paymentMethod'
1074
- creditCardId:
1075
- $ref: '#/components/schemas/Transaction/properties/creditCardId'
1076
- accountId:
1077
- type: string
1078
- description: ID of the associated account (required if paymentMethod is not CREDIT)
1079
- example: "acc_123456789"
1080
- installments:
1081
- type: integer
1082
- minimum: 1
1083
- description: Number of installments (optional)
1084
- example: 3
1085
- targetDueMonth:
1086
- type: string
1087
- pattern: "^\\d{4}-\\d{2}$"
1088
- description: Target month for due date in YYYY-MM format (optional)
1089
- example: "2026-03"
1090
- purchaseDate:
1091
- type: string
1092
- format: date
1093
- description: Actual purchase date (credit card only, optional)
1094
- example: "2026-02-10"
1095
- recurrence:
1096
- type: object
1097
- properties:
1098
- frequency:
1099
- $ref: '#/components/schemas/RecurrenceRule/properties/frequency'
1100
- interval:
1101
- $ref: '#/components/schemas/RecurrenceRule/properties/interval'
1102
- endDate:
1103
- $ref: '#/components/schemas/RecurrenceRule/properties/endDate'
1104
- occurrences:
1105
- $ref: '#/components/schemas/RecurrenceRule/properties/occurrences'
1106
- responses:
1107
- '201':
1108
- description: Transaction created successfully
1109
- content:
1110
- application/json:
1111
- schema:
1112
- $ref: '#/components/schemas/Transaction'
1113
- '400':
1114
- description: Invalid input or target statement is already closed (paid)
1115
- '401':
1116
- $ref: '#/components/responses/UnauthorizedError'
1117
-
1118
- get:
1119
- summary: Get all transactions
1120
- parameters:
1121
- - name: month
1122
- in: query
1123
- required: false
1124
- schema:
1125
- type: string
1126
- pattern: "^\\d{4}-\\d{2}$"
1127
- description: Filter transactions by month (YYYY-MM format)
1128
- example: "2026-03"
1129
- - name: accountId
1130
- in: query
1131
- required: false
1132
- schema:
1133
- type: string
1134
- description: Filter transactions by account ID
1135
- example: "acc_123456789"
1136
- - name: categoryId
1137
- in: query
1138
- required: false
1139
- schema:
1140
- type: string
1141
- description: Filter transactions by category ID
1142
- example: "cat_123456789"
1143
- - name: creditCardId
1144
- in: query
1145
- required: false
1146
- schema:
1147
- type: string
1148
- description: Filter transactions by credit card ID
1149
- example: "cc_123456789"
1150
- - name: type
1151
- in: query
1152
- required: false
1153
- schema:
1154
- type: string
1155
- enum: [INCOME, EXPENSE]
1156
- description: Filter transactions by type
1157
- example: "EXPENSE"
1158
- - name: startDate
1159
- in: query
1160
- required: false
1161
- schema:
1162
- type: string
1163
- format: date
1164
- description: Filter transactions starting from this date (inclusive)
1165
- example: "2026-01-01"
1166
- - name: endDate
1167
- in: query
1168
- required: false
1169
- schema:
1170
- type: string
1171
- format: date
1172
- description: Filter transactions up to this date (inclusive)
1173
- example: "2026-01-31"
1174
- - name: paid
1175
- in: query
1176
- required: false
1177
- schema:
1178
- type: boolean
1179
- description: Filter by payment status (true = paid, false = unpaid)
1180
- example: false
1181
- responses:
1182
- '200':
1183
- description: List of transactions
1184
- content:
1185
- application/json:
1186
- schema:
1187
- type: array
1188
- items:
1189
- $ref: '#/components/schemas/Transaction'
1190
- '401':
1191
- $ref: '#/components/responses/UnauthorizedError'
1192
-
1193
- /transactions/{id}/pay:
1194
- patch:
1195
- summary: Mark a transaction as paid/received
1196
- description: |
1197
- Marks a transaction as paid or received.
1198
- **Note:** Credit card transactions cannot be marked as paid directly. They are automatically
1199
- marked as paid when the credit card statement is paid via the `POST /credit-cards/{id}/pay-statement` endpoint.
1200
- parameters:
1201
- - name: id
1202
- in: path
1203
- required: true
1204
- schema:
1205
- type: string
1206
- description: Transaction ID
1207
- responses:
1208
- '200':
1209
- description: Transaction marked as paid
1210
- content:
1211
- application/json:
1212
- schema:
1213
- $ref: '#/components/schemas/Transaction'
1214
- '400':
1215
- description: Cannot mark credit card transaction as paid directly
1216
- '401':
1217
- $ref: '#/components/responses/UnauthorizedError'
1218
- '404':
1219
- description: Transaction not found
1220
-
1221
- /transactions/{id}/unpay:
1222
- patch:
1223
- summary: Mark a transaction as unpaid
1224
- parameters:
1225
- - name: id
1226
- in: path
1227
- required: true
1228
- schema:
1229
- type: string
1230
- description: Transaction ID
1231
- responses:
1232
- '200':
1233
- description: Transaction marked as unpaid
1234
- content:
1235
- application/json:
1236
- schema:
1237
- $ref: '#/components/schemas/Transaction'
1238
- '404':
1239
- description: Transaction not found
1240
- '401':
1241
- $ref: '#/components/responses/UnauthorizedError'
1242
-
1243
- /transactions/{id}:
1244
- get:
1245
- summary: Get a transaction by ID
1246
- parameters:
1247
- - name: id
1248
- in: path
1249
- required: true
1250
- schema:
1251
- type: string
1252
- description: Transaction ID
1253
- responses:
1254
- '200':
1255
- description: Transaction found
1256
- content:
1257
- application/json:
1258
- schema:
1259
- $ref: '#/components/schemas/Transaction'
1260
- '401':
1261
- $ref: '#/components/responses/UnauthorizedError'
1262
- '404':
1263
- description: Transaction not found
1264
-
1265
- patch:
1266
- summary: Update a transaction
1267
- description: |
1268
- Update a transaction.
1269
- **Note:** Transactions that have already been paid cannot be edited.
1270
- For credit card transactions, you can use targetDueMonth to automatically calculate the date based on the credit card's due day.
1271
-
1272
- **Recurring Transactions - Editable Fields by Mode:**
1273
- - **SINGLE**: Can edit `name`, `categoryId`, `date`, `targetDueMonth`, `amount`
1274
- - **PENDING/ALL**: Can edit `name`, `categoryId`, `amount`, `paymentMethod`, `accountId`, `creditCardId` (date and type are restricted to prevent desynchronization)
1275
-
1276
- **Installment Transactions - Editable Fields by Mode:**
1277
- - **PENDING/ALL**: Only `name`, `categoryId`, and `amount` are propagated to other installments. All other fields are ignored for the bulk update.
1278
- parameters:
1279
- - name: id
1280
- in: path
1281
- required: true
1282
- schema:
1283
- type: string
1284
- description: Transaction ID
1285
- - name: mode
1286
- in: query
1287
- required: false
1288
- schema:
1289
- type: string
1290
- enum: [SINGLE, PENDING, ALL]
1291
- default: SINGLE
1292
- description: |
1293
- Update mode for recurring or installment transactions:
1294
- - **SINGLE**: Update only this specific transaction (default)
1295
- - **PENDING**: Update this transaction and all future unpaid transactions in the same recurrence series or installment group
1296
- - **ALL**: For recurrences, update all transactions (paid or unpaid). For installments, behaves the same as PENDING (only unpaid installments from this one onward are updated)
1297
-
1298
- If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1299
- example: SINGLE
1300
- requestBody:
1301
- required: true
1302
- content:
1303
- application/json:
1304
- schema:
1305
- $ref: '#/components/schemas/UpdateTransactionRequest'
1306
- responses:
1307
- '200':
1308
- description: Transaction updated successfully
1309
- content:
1310
- application/json:
1311
- schema:
1312
- $ref: '#/components/schemas/Transaction'
1313
- '400':
1314
- description: Invalid input or transaction is already paid
1315
- '401':
1316
- $ref: '#/components/responses/UnauthorizedError'
1317
- '404':
1318
- description: Transaction not found
1319
-
1320
- delete:
1321
- summary: Delete a transaction
1322
- parameters:
1323
- - name: id
1324
- in: path
1325
- required: true
1326
- schema:
1327
- type: string
1328
- description: Transaction ID
1329
- - name: mode
1330
- in: query
1331
- required: false
1332
- schema:
1333
- type: string
1334
- enum: [SINGLE, PENDING, ALL]
1335
- default: SINGLE
1336
- description: |
1337
- Deletion mode for recurring or installment transactions:
1338
- - **SINGLE**: Delete only this specific transaction (default)
1339
- - **PENDING**: Delete this transaction and all future unpaid transactions in the same recurrence series or installment group
1340
- - **ALL**: For recurrences, delete all transactions (paid or unpaid). For installments, behaves the same as PENDING (only unpaid installments from this one onward are deleted)
1341
-
1342
- If the transaction is not part of a recurrence series or installment group, this parameter is ignored.
1343
- example: SINGLE
1344
- responses:
1345
- '200':
1346
- description: Transaction deleted successfully
1347
- '401':
1348
- $ref: '#/components/responses/UnauthorizedError'
1349
- '404':
1350
- description: Transaction not found
1351
-
1352
- /summary:
1353
- get:
1354
- summary: Get financial summary
1355
- description: >
1356
- Returns income, expenses, balance, credit card totals, and category breakdowns.
1357
- Provide either `month` (YYYY-MM) or both `startDate` and `endDate` (YYYY-MM-DD).
1358
- parameters:
1359
- - name: month
1360
- in: query
1361
- required: false
1362
- schema:
1363
- type: string
1364
- pattern: "^\\d{4}-\\d{2}$"
1365
- description: Month in YYYY-MM format
1366
- example: "2026-02"
1367
- - name: startDate
1368
- in: query
1369
- required: false
1370
- schema:
1371
- type: string
1372
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1373
- description: Start date in YYYY-MM-DD format (use with endDate for a custom range)
1374
- example: "2026-01-01"
1375
- - name: endDate
1376
- in: query
1377
- required: false
1378
- schema:
1379
- type: string
1380
- pattern: "^\\d{4}-\\d{2}-\\d{2}$"
1381
- description: End date in YYYY-MM-DD format (use with startDate for a custom range)
1382
- example: "2026-03-31"
1383
- responses:
1384
- '200':
1385
- description: Financial summary for the given period
1386
- content:
1387
- application/json:
1388
- schema:
1389
- $ref: '#/components/schemas/Summary'
1390
- '400':
1391
- description: Invalid or missing period parameters
1392
- '401':
1393
- $ref: '#/components/responses/UnauthorizedError'
1394
-
1395
- /accounts:
1396
- post:
1397
- summary: Create a new account
1398
- requestBody:
1399
- required: true
1400
- content:
1401
- application/json:
1402
- schema:
1403
- type: object
1404
- required:
1405
- - name
1406
- - type
1407
- properties:
1408
- name:
1409
- type: string
1410
- description: Name of the account
1411
- example: "Itaú Checking Account"
1412
- type:
1413
- type: string
1414
- enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1415
- description: Type of account
1416
- example: "BANK_ACCOUNT"
1417
- initialBalance:
1418
- type: number
1419
- format: float
1420
- description: Initial balance for the account
1421
- example: 1000.00
1422
- responses:
1423
- '201':
1424
- description: Account created successfully
1425
- content:
1426
- application/json:
1427
- schema:
1428
- $ref: '#/components/schemas/Account'
1429
- '400':
1430
- description: Invalid input
1431
- '401':
1432
- $ref: '#/components/responses/UnauthorizedError'
1433
-
1434
- get:
1435
- summary: Get all accounts
1436
- responses:
1437
- '200':
1438
- description: List of accounts with current balances
1439
- content:
1440
- application/json:
1441
- schema:
1442
- type: array
1443
- items:
1444
- $ref: '#/components/schemas/Account'
1445
- '401':
1446
- $ref: '#/components/responses/UnauthorizedError'
1447
-
1448
- /accounts/{id}:
1449
- get:
1450
- summary: Get a specific account
1451
- parameters:
1452
- - name: id
1453
- in: path
1454
- required: true
1455
- schema:
1456
- type: string
1457
- description: Account ID
1458
- responses:
1459
- '200':
1460
- description: Account details
1461
- content:
1462
- application/json:
1463
- schema:
1464
- $ref: '#/components/schemas/Account'
1465
- '401':
1466
- $ref: '#/components/responses/UnauthorizedError'
1467
- '404':
1468
- description: Account not found
1469
-
1470
- patch:
1471
- summary: Update an account
1472
- parameters:
1473
- - name: id
1474
- in: path
1475
- required: true
1476
- schema:
1477
- type: string
1478
- description: Account ID
1479
- requestBody:
1480
- required: true
1481
- content:
1482
- application/json:
1483
- schema:
1484
- type: object
1485
- properties:
1486
- name:
1487
- type: string
1488
- description: Name of the account
1489
- example: "Itaú Savings Account"
1490
- type:
1491
- type: string
1492
- enum: [BANK_ACCOUNT, WALLET, SAVINGS_ACCOUNT, INVESTMENT_ACCOUNT, OTHER]
1493
- description: Type of account
1494
- example: "SAVINGS_ACCOUNT"
1495
- responses:
1496
- '200':
1497
- description: Account updated successfully
1498
- content:
1499
- application/json:
1500
- schema:
1501
- $ref: '#/components/schemas/Account'
1502
- '400':
1503
- description: Invalid input
1504
- '401':
1505
- $ref: '#/components/responses/UnauthorizedError'
1506
- '404':
1507
- description: Account not found
1508
-
1509
- delete:
1510
- summary: Delete an account
1511
- parameters:
1512
- - name: id
1513
- in: path
1514
- required: true
1515
- schema:
1516
- type: string
1517
- description: Account ID
1518
- responses:
1519
- '204':
1520
- description: Account deleted successfully
1521
- '401':
1522
- $ref: '#/components/responses/UnauthorizedError'
1523
- '404':
1524
- description: Account not found
1525
- '409':
1526
- description: Cannot delete account with associated transactions
1527
-
1528
- /accounts/{id}/balance:
1529
- get:
1530
- summary: Get the current balance for an account
1531
- parameters:
1532
- - name: id
1533
- in: path
1534
- required: true
1535
- schema:
1536
- type: string
1537
- description: Account ID
1538
- responses:
1539
- '200':
1540
- description: Account balance
1541
- content:
1542
- application/json:
1543
- schema:
1544
- $ref: '#/components/schemas/AccountBalance'
1545
- '401':
1546
- $ref: '#/components/responses/UnauthorizedError'
1547
- '404':
1548
- description: Account not found
1549
-
1550
- /accounts/{id}/transactions:
1551
- get:
1552
- summary: Get all transactions linked to an account
1553
- parameters:
1554
- - name: id
1555
- in: path
1556
- required: true
1557
- schema:
1558
- type: string
1559
- description: Account ID
1560
- responses:
1561
- '200':
1562
- description: List of transactions linked to the account
1563
- content:
1564
- application/json:
1565
- schema:
1566
- type: array
1567
- items:
1568
- $ref: '#/components/schemas/Transaction'
1569
- '401':
1570
- $ref: '#/components/responses/UnauthorizedError'
1571
- '404':
1572
- description: Account not found
1573
-
1574
- /export:
1575
- get:
1576
- summary: Export all user data
1577
- description: Returns a complete backup of all user data including settings, categories, accounts, credit cards, recurrence rules, and transactions.
1578
- security:
1579
- - ApiKeyAuth: []
1580
- responses:
1581
- '200':
1582
- description: Export payload with all data
1583
- content:
1584
- application/json:
1585
- schema:
1586
- type: object
1587
- properties:
1588
- version:
1589
- type: string
1590
- example: "1.0"
1591
- exportedAt:
1592
- type: string
1593
- format: date-time
1594
- example: "2026-02-14T21:00:00.000Z"
1595
- data:
1596
- type: object
1597
- properties:
1598
- settings:
1599
- nullable: true
1600
- $ref: '#/components/schemas/Settings'
1601
- categories:
1602
- type: array
1603
- items:
1604
- $ref: '#/components/schemas/Category'
1605
- accounts:
1606
- type: array
1607
- items:
1608
- $ref: '#/components/schemas/Account'
1609
- creditCards:
1610
- type: array
1611
- items:
1612
- $ref: '#/components/schemas/CreditCard'
1613
- recurrenceRules:
1614
- type: array
1615
- items:
1616
- $ref: '#/components/schemas/RecurrenceRule'
1617
- transactions:
1618
- type: array
1619
- items:
1620
- $ref: '#/components/schemas/Transaction'
1621
- '401':
1622
- $ref: '#/components/responses/UnauthorizedError'
1623
-
1624
- /import:
1625
- post:
1626
- summary: Import user data
1627
- description: |
1628
- Imports a previously exported backup. Supports two modes:
1629
- - **reset**: Clears all existing data and replaces it with the imported data.
1630
- - **increment**: Adds new records from the import, ignoring records whose IDs already exist.
1631
- security:
1632
- - ApiKeyAuth: []
1633
- requestBody:
1634
- required: true
1635
- content:
1636
- application/json:
1637
- schema:
1638
- type: object
1639
- required:
1640
- - mode
1641
- - version
1642
- - exportedAt
1643
- - data
1644
- properties:
1645
- mode:
1646
- type: string
1647
- enum: [reset, increment]
1648
- description: Import mode
1649
- example: "reset"
1650
- version:
1651
- type: string
1652
- description: Export format version. Must be "1.0".
1653
- example: "1.0"
1654
- exportedAt:
1655
- type: string
1656
- format: date-time
1657
- example: "2026-02-14T21:00:00.000Z"
1658
- data:
1659
- type: object
1660
- properties:
1661
- settings:
1662
- nullable: true
1663
- $ref: '#/components/schemas/Settings'
1664
- categories:
1665
- type: array
1666
- items:
1667
- $ref: '#/components/schemas/Category'
1668
- accounts:
1669
- type: array
1670
- items:
1671
- $ref: '#/components/schemas/Account'
1672
- creditCards:
1673
- type: array
1674
- items:
1675
- $ref: '#/components/schemas/CreditCard'
1676
- recurrenceRules:
1677
- type: array
1678
- items:
1679
- $ref: '#/components/schemas/RecurrenceRule'
1680
- transactions:
1681
- type: array
1682
- items:
1683
- $ref: '#/components/schemas/Transaction'
1684
- responses:
1685
- '200':
1686
- description: Import completed successfully
1687
- content:
1688
- application/json:
1689
- schema:
1690
- type: object
1691
- properties:
1692
- message:
1693
- type: string
1694
- example: "Import completed successfully (mode: reset)"
1695
- '400':
1696
- description: Invalid input or unsupported version
1697
- '401':
1698
- $ref: '#/components/responses/UnauthorizedError'
1699
-
1700
- /settings:
1701
- post:
1702
- summary: Create global settings (only if not exists)
1703
- requestBody:
1704
- required: true
1705
- content:
1706
- application/json:
1707
- schema:
1708
- type: object
1709
- required:
1710
- - userName
1711
- - language
1712
- - currency
1713
- properties:
1714
- userName:
1715
- type: string
1716
- example: "John Doe"
1717
- language:
1718
- type: string
1719
- enum: [pt-BR, en-US]
1720
- example: "pt-BR"
1721
- currency:
1722
- type: string
1723
- enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1724
- example: "BRL"
1725
- responses:
1726
- '201':
1727
- description: Settings created successfully
1728
- content:
1729
- application/json:
1730
- schema:
1731
- $ref: '#/components/schemas/Settings'
1732
- '400':
1733
- description: Invalid input
1734
- '401':
1735
- $ref: '#/components/responses/UnauthorizedError'
1736
- '409':
1737
- description: Settings already exist
1738
-
1739
- get:
1740
- summary: Get global settings
1741
- responses:
1742
- '200':
1743
- description: Settings retrieved successfully
1744
- content:
1745
- application/json:
1746
- schema:
1747
- $ref: '#/components/schemas/Settings'
1748
- '401':
1749
- $ref: '#/components/responses/UnauthorizedError'
1750
- '404':
1751
- description: Settings not found
1752
-
1753
- put:
1754
- summary: Update global settings
1755
- requestBody:
1756
- required: true
1757
- content:
1758
- application/json:
1759
- schema:
1760
- type: object
1761
- properties:
1762
- userName:
1763
- type: string
1764
- example: "John Doe"
1765
- language:
1766
- type: string
1767
- enum: [pt-BR, en-US]
1768
- example: "pt-BR"
1769
- currency:
1770
- type: string
1771
- enum: [BRL, USD, EUR, GBP, JPY, CAD, AUD, CHF]
1772
- example: "BRL"
1773
- responses:
1774
- '200':
1775
- description: Settings updated successfully
1776
- content:
1777
- application/json:
1778
- schema:
1779
- $ref: '#/components/schemas/Settings'
1780
- '400':
1781
- description: Invalid input
1782
- '401':
1783
- $ref: '#/components/responses/UnauthorizedError'
1784
- '404':
1785
- description: Settings not found
1786
-
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
+