Links

Logout Current User Session

This endpoint allows an authenticated user to log out of any of their sessions on the workspace. It is designed specifically for the user to terminate their sessions and cannot be used to log out sessions belonging to other users on the workspace.
URL
Requires Auth
HTTP Method
/api/v1/sessions/logout.me
yes
POST

Headers

Argument
Example
Required
Description
X-User-Id
myuser-name
Required
The authenticated user ID.
X-Auth-Token
myauth-token
Required
Auth token.

Payload

Argument
Example
Required
Description
sessionId
WJ2giBwm4B9mcojFi
Required
The session id.

Example payload

{
"sessionId":"WJ2giBwm4B9mcojFi"
}

Example Call

curl --location 'http://localhost:3000/api/v1/sessions/logout.me' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: ocFlTSMfowj9tSH1vQV6ANL9SiahkKUK1KhU_PpAUtT' \
--header 'X-User-Id: 2tTEqR7ZNMJ4HGGNa' \
--data '{
"sessionId": "WJ2giBwm4B9mcojFi"
}'

Example Result

Success

{
"sessionId": "WJ2giBwm4B9mcojFi",
"success": true
}

Error

Any of the following errors can occur on the endpoint.
  • Authorization: Requires an authentication token for the request to be made.
  • Session not found: Occurs when the sessionId doesn't belong to the current user making the request or does not exist.
Authorization
Session not found
{
"status": "error",
"message": "You must be logged in to do this."
}
{
"success": false,
"error": "Session not found"
}

Change Log

Version
Description
5.0.0
Added
Last modified 2mo ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.