Manage active sessions for the authenticated user. Each login creates a new session. Sessions track the user agent and IP address for security visibility.
List Sessions
GET /api/v1/users/me/sessions
Requires a valid Bearer token.
Returns all active (non-expired) sessions for the authenticated user, sorted by most recently used.
Response
Array of session objects. Browser or client user agent string.
IP address that created the session.
ISO 8601 timestamp of last activity.
ISO 8601 session expiration timestamp.
ISO 8601 session creation timestamp.
true if this is the session making the request.
Total number of active sessions.
{
"sessions" : [
{
"id" : "ses_abc123def456" ,
"userAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)" ,
"ipAddress" : "192.168.1.1" ,
"lastUsedAt" : "2024-01-21T09:00:00Z" ,
"expiresAt" : "2024-01-28T09:00:00Z" ,
"createdAt" : "2024-01-21T08:00:00Z" ,
"isCurrent" : true
},
{
"id" : "ses_xyz789ghi012" ,
"userAgent" : "BunShip-CLI/1.0" ,
"ipAddress" : "10.0.0.5" ,
"lastUsedAt" : "2024-01-20T15:00:00Z" ,
"expiresAt" : "2024-01-27T15:00:00Z" ,
"createdAt" : "2024-01-20T12:00:00Z" ,
"isCurrent" : false
}
],
"total" : 2
}
Example
curl https://api.bunship.com/api/v1/users/me/sessions \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
Revoke Session
DELETE /api/v1/users/me/sessions/{sessionId}
Requires a valid Bearer token.
Revokes a specific session, logging out that device. You cannot revoke the current session — use the logout endpoint instead.
Path Parameters
The ID of the session to revoke.
Response
{
"message" : "Session revoked successfully"
}
Errors
Status Code Description 400VALIDATION_ERRORCannot revoke the current session 401AUTHENTICATION_ERRORMissing or invalid Bearer token 404NOT_FOUNDSession not found or does not belong to this user
Example
curl -X DELETE https://api.bunship.com/api/v1/users/me/sessions/ses_xyz789ghi012 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."