Users
Sign out all sessions for a user (server-side)
Server-side endpoint. Requires a project-scoped API key. Ends all sessions for the specified end-user. The user must belong to the project associated with the API key. Attempting to act on a user from a different project returns `404` without leaking account existence. This is a server-initiated action. No fresh token pair is returned (the caller is an API key, not a user session). This action writes an audit log entry. JWT caller tokens are not accepted. End users who want to revoke their own sessions should use `POST /api/users/sessions/end-all`.
/api/users/{userId}/sessions/end-allSDK setup
Create a client and set credentials (JWT and/or API key) before calling the API. Match the authentication type shown above.
import { Configuration, UsersApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
apiKey: 'sk_live_mudbase_doc_Xk9mP2qR7vN4wL8jH3tY6uE',
});
const users = new UsersApi(configuration);Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const { data: result } = await users.endAllSessionsForUser("usr_FQMcXax8wDv87s");Playground
liveTest this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Authentication
X-API-Key: YOUR_KEY header (server-to-server, SDKs). View authentication guide →Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | The MongoDB ObjectId of the user whose sessions should be ended. |
Responses
{
"message": "User sessions ended."
}{
"error": "program back up"
}{
"error": "program back up"
}{
"error": "program back up"
}Errors
| Code | Meaning |
|---|---|
400 | Invalid user ID format. |
403 | Forbidden. Either the API key is not scoped to a project, or a user JWT was supplied instead of an API key. |
404 | User not found in this project. |