Logout
Log out the current session and optionally revoke tokens across all devices.
Logout
POST
/api/v1/auth/logoutLog out the current session and optionally revoke tokens across all devices.
Authentication:Bearer Token
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
refresh_token | string | Optional | The refresh token to revoke. If omitted, only the current access token is invalidated. |
all_devices | boolean | Optional | Set to true to log out from all devices, revoking all active sessions and tokens for this user. |
except_current | boolean | Optional | When 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."
}
}Related Endpoints
- Login -- Login
- Refresh Token -- Refresh Token