Skip to main content
POST
Logout the current user
Logout the current user by invalidating their session token. Requires a valid authentication token. After calling this endpoint remove the user data from the client.

Request

Headers

Response

200 OK - Successfully logged out

401 Unauthorized

500 Internal Server Error

Example

Notes

  • This endpoint requires a valid JWT token in the Authorization header
  • The server will invalidate the session token, making it unusable for future requests
  • After successful logout, remove all user data from client-side storage
  • Clear any stored tokens, user information, or session data from your application
  • The response includes a personalized message with the user’s name
  • This is the recommended way to properly log out users from the system

Client-side Implementation

After calling this endpoint, you should:
  1. Remove the JWT token from storage (localStorage, sessionStorage, cookies)
  2. Clear user data from your application state
  3. Redirect the user to the login page
  4. Clear any cached data that requires authentication

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Successfully logged out user

message
string
Example:

"Successfully logged out John Doe"

data
object