Logout

Log out the current session and optionally revoke tokens across all devices.

Logout

POST/api/v1/auth/logout

Log out the current session and optionally revoke tokens across all devices.

Authentication:Bearer Token

Request Parameters

ParameterTypeRequiredDescription
refresh_tokenstringOptionalThe refresh token to revoke. If omitted, only the current access token is invalidated.
all_devicesbooleanOptionalSet to true to log out from all devices, revoking all active sessions and tokens for this user.
except_currentbooleanOptionalWhen used with all_devices, keeps the current session active while logging out all other devices.

Code Examples

curl -X POST https://api.orbai.world/api/v1/auth/logout \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
        "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2...",
        "all_devices": false,
        "except_current": false
    }'

Responses

200Logout successful. The specified tokens have been revoked.
{
  "success": true,
  "data": {
    "message": "Successfully logged out.",
    "revoked_sessions": 1
  }
}
401The access token is missing, invalid, or expired.
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired access token."
  }
}