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`.

AuthAPI Key
GroupUsers
Rate limitSee Rate Limits
POST/api/users/{userId}/sessions/end-all

SDK 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

live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

Get your API key from the console

No Request Yet

Send a request to see the full inspector

Authentication

Requires API Key
Note
Include your API key in the X-API-Key: YOUR_KEY header (server-to-server, SDKs). View authentication guide →

Path Parameters

NameTypeRequiredDescription
userIdstringYesThe MongoDB ObjectId of the user whose sessions should be ended.

Responses

200Sessions ended.
json
{
  "message": "User sessions ended."
}
400Invalid user ID format.
json
{
  "error": "program back up"
}
403Forbidden. Either the API key is not scoped to a project, or a user JWT was supplied instead of an API key.
json
{
  "error": "program back up"
}
404User not found in this project.
json
{
  "error": "program back up"
}

Errors

CodeMeaning
400Invalid user ID format.
403Forbidden. Either the API key is not scoped to a project, or a user JWT was supplied instead of an API key.
404User not found in this project.
Edit this page on GitHub
Chat with us