All device endpoints require authentication. Include the session token in the
Authorization header as Bearer {token} or rely on the session cookie.List Devices
Returns all devices associated with the authenticated user, ordered by most recently seen.Headers
Bearer token:
Bearer {sessionToken}Response
Array of device objects
Device ID (UUID)
Device name
Device type:
"phone", "computer", or "tablet"Browser name
Operating system
ISO 8601 timestamp of last activity
Whether device is currently active (not revoked)
Whether this is the current session’s device
Get Pending Login Requests
Returns pending login approval requests for the authenticated user’s account.Headers
Bearer token:
Bearer {sessionToken}Response
Array of pending login request objects
Request ID (UUID)
Requesting device name
Requesting device type
Requesting device browser
Requesting device OS
IP address of the login request
ISO 8601 timestamp when request was created
ISO 8601 timestamp when request expires (5 minutes from creation)
Ephemeral public key from requesting device for E2EE key exchange
Approve Login Request
Approves a pending login request by encrypting and sending the master key to the requesting device.Headers
Bearer token:
Bearer {sessionToken}Request Body
Login request ID (UUID)
Master key encrypted with the requester’s public key (from requesterPublicKey)
Approver’s ephemeral public key for key exchange
Response
Always
true on successful approvalError Responses
"Request not found"(404) - Invalid request ID"Request already handled"(400) - Request was already approved or denied"Request expired"(400) - Request has expired (5 minute timeout)"Unauthorized"(403) - Request doesn’t belong to the authenticated user
Deny Login Request
Denies a pending login request.Headers
Bearer token:
Bearer {sessionToken}Request Body
Login request ID (UUID)
Response
Always
true on successful denialError Responses
"Request not found"(404) - Invalid request ID"Unauthorized"(403) - Request doesn’t belong to the authenticated user
Update Device Name
Updates the name of a device.Headers
Bearer token:
Bearer {sessionToken}Path Parameters
Device ID (UUID)
Request Body
New device name (1-64 characters)
Response
Always
true on successful updateError Responses
"Device not found"(404) - Device doesn’t exist or doesn’t belong to user
Revoke Device
Revokes a device, removing it from trusted devices and invalidating all its sessions. Cannot revoke the current session’s device.Headers
Bearer token:
Bearer {sessionToken}Path Parameters
Device ID (UUID)
Response
Always
true on successful revocationError Responses
"Cannot revoke current device"(400) - Attempted to revoke the device of the current session"Device not found"(404) - Device doesn’t exist or doesn’t belong to user
Device Lifecycle
Device Creation
Devices are created automatically during:- Registration (
/api/register/complete) - Login with passkey (
/api/login/passkey) - Login with trust code (
/api/login/trust-code) - Approved device login (
/api/login/request-status/:requestIdwhen approved)
Device Fingerprinting
The optionalfingerprint field (max 64 characters) uniquely identifies a device:
- When logging in, if the fingerprint matches an existing device, that device is reused
- The device’s
lastSeenAt,name,browser, andosare updated - If no match is found, a new device record is created
Device Cleanup
Devices are automatically marked as inactive:- When manually revoked via
DELETE /api/devices/:deviceId - When inactive for 14+ days (automatic cleanup process)
- Have all their sessions deleted
- Are marked with
isActive: false - Are kept in the database for audit purposes
Login Approval Flow
- Request: New device calls
/api/login/request-approvalwith ephemeral public key - Notification: Trusted devices receive WebSocket notification and/or push notification
- Fetch: Trusted device calls
/api/devices/pending-requeststo get details - Decision: User reviews request details (device name, type, IP, etc.)
- Encrypt: Trusted device encrypts master key with requester’s public key
- Approve/Deny: Call
/api/devices/approve-requestor/api/devices/deny-request - Complete: Requesting device polls
/api/login/request-status/:requestIdand receives encrypted key
Security Features
- E2EE Key Exchange: Uses ephemeral key pairs to securely transfer master key
- 5 Minute Timeout: Requests expire automatically
- WebSocket + Push: Real-time notifications to trusted devices
- IP Tracking: Shows requesting device’s IP address for verification
- Activity Logging: All approvals/denials logged with severity levels
Activity Logging
Device operations are logged:device_removed(severity: warning) - Manual device revocationdevice_auto_removed(severity: info) - Automatic cleanup after 14 dayslogin_approved(severity: info) - Approval of login requestlogin_denied(severity: warning) - Denial of login request