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

ArgumentExampleRequiredDescription

X-User-Id

myuser-name

Required

The authenticated user ID.

X-Auth-Token

myauth-token

Required

Auth token.

Payload

ArgumentExampleRequiredDescription

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.

{
    "status": "error",
    "message": "You must be logged in to do this."
}

Change Log

VersionDescription

5.0.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.