This document defines the new/additional backend REST API endpoints required to make the user profile page fully functional.
All endpoints require authorization using a JWT bearer token.
Every request to these endpoints must include the following headers:
| Header Name | Value / Format | Description |
|---|---|---|
Authorization |
Bearer <JWT_ACCESS_TOKEN> |
User authentication token |
Content-Type |
application/json |
Required for all request payloads (POST, PUT, PATCH) |
Manages user-specific preferences such as UI language and default payment modes.
Fetches the current user's profile and preferences.
- URL:
/api/user/preferences - Method:
GET - Response Status:
200 OK - Response Body:
{
"language": "English",
"defaultPaymentModeId": 1
}Updates the current user's preferences (e.g., language selection or default payment mode).
- URL:
/api/user/preferences - Method:
PATCH - Request Body:
{
"language": "Hindi",
"defaultPaymentModeId": 2
}- Response Status:
200 OK - Response Body:
{
"language": "Hindi",
"defaultPaymentModeId": 2
}Manages the list of linked bank accounts, credit cards, or cash accounts.
Retrieves the user's linked bank accounts and credit cards.
- URL:
/api/account - Method:
GET - Response Status:
200 OK - Response Body:
[
{
"id": "1",
"bankName": "HDFC Bank",
"lastFour": "4321",
"type": "Savings",
"amount": 25000.50
},
{
"id": "2",
"bankName": "ICICI Credit Card",
"lastFour": "9876",
"type": "Credit",
"amount": 100000.00
},
{
"id": "3",
"bankName": "Wallet Cash",
"lastFour": "0000",
"type": "Cash",
"amount": 1500.00
}
]Links a new bank account or credit card to the user's profile.
- URL:
/api/account - Method:
POST - Request Body:
{
"bankName": "SBI Bank",
"lastFour": "5678",
"type": "Savings",
"amount": 15000.00
}- Response Status:
201 Created - Response Body:
{
"id": "4",
"bankName": "SBI Bank",
"lastFour": "5678",
"type": "Savings",
"amount": 15000.00
}