API Method: DELETE /settings/devices/{deviceId}
DELETE /settings/devices/{deviceId}
Description:
This API method is used to remove or disconnect a specific device that has access to a user’s account. The device is identified by its unique deviceId
. Once deleted, the device will no longer be able to access the user's account, enhancing account security by preventing unauthorized or unwanted devices from logging in.
Endpoint:
DELETE /settings/devices/{deviceId}
Functionality:
- Purpose: Removes a connected device from the user's list of authorized devices, revoking its access to the account.
- User Flow: When a user detects an unfamiliar device or wants to revoke access from a device (e.g., due to theft or loss), they can use this API to delete the device, ensuring it can no longer log in or perform actions on the account.
Request Headers:
- Authorization: Bearer token required to authenticate the user and authorize the device removal.
- Content-Type:
application/json
Path Parameters:
- deviceId (string, required): The unique identifier of the device to be removed. This ID is obtained from the list of connected devices (retrieved via
GET /settings/devices
).
Response:
-
200 OK: Indicates that the device has been successfully deleted, and it no longer has access to the account.
Example response:
{ "message": "Device successfully removed" }
-
404 Not Found: If the
deviceId
does not match any connected devices, indicating that the device is not recognized. -
401 Unauthorized: If the bearer token is invalid or expired, indicating that the user is not authenticated to perform the operation.
-
500 Internal Server Error: If there is an issue removing the device due to a server-side error.
Notes:
- Security: This API helps secure the account by ensuring that lost, stolen, or unauthorized devices can be quickly disconnected from the user’s account.
- Device Management: Users can manage their connected devices by first retrieving the list of connected devices with the
GET /settings/devices
endpoint, and then selectively removing any device that should no longer have access. - Logout: In some implementations, removing a device will also log it out immediately if it is currently logged into the account.