Skip to content

Conversation

@mcalinghee
Copy link
Contributor

@mcalinghee mcalinghee commented Nov 19, 2025

Fixes #4687
Add Kill Session API : /api/admin/v1/users/{id}/kill-sessions

This will terminate all sessions for a user.

This is based on KillSession Command within the CLI.

image

@mcalinghee mcalinghee requested a review from a team as a code owner November 19, 2025 09:59
@mcalinghee
Copy link
Contributor Author

Not sure if we want to add this API in User API

Maybe we want to add a new API as in Job API

@mcalinghee
Copy link
Contributor Author

mcalinghee commented Nov 20, 2025

Here is another approach by introducing Job API.

Job schema(DB Model : queue_job):

  • id
  • status
  • scheduled_at
  • finished_at
  • completed_at
  • failed_at
  • failed_reason
    ..

New APIs:

POST /api/admin/v1/compat-sessions/finish-bulk
- Request Body : 
filter[user_ids] - list of User Ids that we will kill sessions for
filter[last_active_at_from] - we will kill the sessions for users that were connected before `last_active_at_from`
- Response: JobId


POST /api/admin/v1/oauth2-sessions/finish-bulk
- Request Body : 
filter[user_ids] - list of User Ids that we will kill sessions for
filter[last_active_at_from] - we will kill the sessions for users that were connected before `last_active_at_from`
- Response: JobId

POST /api/admin/v1/user-sessions/finish-bulk
filter[user_ids] - list of User Ids that we will kill sessions for
filter[last_active_at_from] - we will kill the sessions for users that were connected before `last_active_at_from`
- Response: JobId

GET /api/admin/v1/jobs/{id}
Response: Job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin API endpoint to terminate specified sessions

1 participant