This endpoint allows an authorized user to log out other user's session on the workspace. It provides the capability to terminate sessions of other users, ensuring workspace security and management.
{% hint style="info" %}
- It requires the
logout-device-management
permission. - It requires two-factor authentication. {% endhint %}
URL | Requires Auth | HTTP Method |
---|---|---|
/api/v1/sessions/logout |
yes |
POST |
Argument | Example | Required | Description |
---|---|---|---|
X-User-Id | myuser-name | Required | The authenticated user ID. |
X-Auth-Token | myauth-token | Required | Auth token. |
x-2fa-code | 148750 | Required | The 2fa code. |
Argument | Example | Required | Description |
---|---|---|---|
sessionId |
WJ2giBwm4B9mcojFi |
Required | The session id. |
{
"sessionId":"tTouumJMrHMjnedWf"
}
curl --location 'http://localhost:3000/api/v1/sessions/logout' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: ocFlTSMfowj9tSH1vQV6ANL9SiahkKUK1KhU_PpAUtT' \
--header 'X-User-Id: 2tTEqR7ZNMJ4HGGNa' \
--header 'x-2fa-code: 505403' \
--data '{
"sessionId":"tTouumJMrHMjnedWf"
}'
{
"sessionId": "tTouumJMrHMjnedWf",
"success": true
}
Any of the following errors can occur on the endpoint.
- Authorization: Requires an authentication token for the request to be made.
- No Permission: Occurs when the authenticated user doesn't have the
logout-device-management
permission. - TOTP Required: Requires two-factor authentication for the request to be made.
- Invalid TOTP: Requires a valid two-factor authentication code.
- Session not found: Occurs when the
sessionId
does not exist.
{% tabs %} {% tab title="Authorization" %}
{
"status": "error",
"message": "You must be logged in to do this."
}
{% endtab %}
{% tab title="No Permission" %}
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}
{% endtab %}
{% tab title="Session not found" %}
{
"success": false,
"error": "Session not found"
}
{% endtab %}
{% tab title="TOTP Required" %}
{
"success": false,
"error": "TOTP Required [totp-required]",
"errorType": "totp-required",
"details": {
"method": "totp",
"codeGenerated": false,
"availableMethods": [
"totp"
]
}
}
{% endtab %}
{% tab title="Invalid TOTP" %}
{
"success": false,
"error": "TOTP Invalid [totp-invalid]",
"errorType": "totp-invalid",
"details": {
"method": "totp",
"codeGenerated": false
}
}
{% endtab %} {% endtabs %}
Version | Description |
---|---|
5.0.0 | Added |