API Method: GET /settings/devices
GET /settings/devices
Description:
This API method retrieves a list of devices that are currently connected to or have accessed a user's account. It provides details about each device, such as device name, type, IP address, and the last login time. The method is typically used in a banking application to help users manage the devices authorized to access their account and detect any unfamiliar or unauthorized activity.
Endpoint:
GET /settings/devices
Functionality:
- Purpose: Fetches a list of all devices connected to the user’s account, giving the user visibility into what devices are authorized to access their banking services. This is essential for account security, allowing users to manage and potentially revoke access from unrecognized devices.
- User Flow: The user can view the list of devices that have accessed their account and may use this information to maintain account security or take action (e.g., log out of a suspicious device).
Request Headers:
- Authorization: Bearer token required to authenticate the user and authorize access to their list of connected devices.
- Content-Type:
application/json
Response:
-
200 OK: Returns a JSON array containing details of the devices that are currently authorized or have previously accessed the user's account.
Example response:
[ { "deviceId": "12345", "deviceName": "iPhone 13", "deviceType": "Mobile", "ipAddress": "192.168.1.1", "lastLogin": "2024-09-20T15:30:00Z" }, { "deviceId": "67890", "deviceName": "MacBook Pro", "deviceType": "Desktop", "ipAddress": "172.16.1.1", "lastLogin": "2024-09-22T12:00:00Z" } ]
deviceId
(string): A unique identifier for the device.deviceName
(string): The name of the device (e.g., iPhone, MacBook, or other user-defined names).deviceType
(string): The type of device (e.g., Mobile, Tablet, Desktop).ipAddress
(string): The IP address from which the device last accessed the account.lastLogin
(string): The date and time (in ISO 8601 format) when the device last accessed the account.
-
401 Unauthorized: If the bearer token is invalid or expired, indicating that the user is not authenticated.
-
500 Internal Server Error: If there is an issue retrieving the connected devices due to a server-side error.
Example Response:
[
{
"deviceId": "12345",
"deviceName": "iPhone 13",
"deviceType": "Mobile",
"ipAddress": "192.168.1.1",
"lastLogin": "2024-09-20T15:30:00Z"
},
{
"deviceId": "67890",
"deviceName": "MacBook Pro",
"deviceType": "Desktop",
"ipAddress": "172.16.1.1",
"lastLogin": "2024-09-22T12:00:00Z"
}
]
Notes:
- Security: This endpoint helps users monitor and manage which devices have access to their account. If an unrecognized device appears on the list, users may want to change their password or log out of that device for security purposes.
- Device Management: In combination with other endpoints (such as for revoking device access), this API helps users control authorized devices and protect against unauthorized logins.
- IP Address: The IP address information is useful for identifying the location or network from which the device accessed the account.