Skip to main content
POST
https://api.bunship.com
/
api
/
v1
/
auth
/
logout
Logout
curl --request POST \
  --url https://api.bunship.com/api/v1/auth/logout \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "allSessions": true
}
'
{
  "message": "Logged out successfully"
}
Logs out the user by revoking the current session. Optionally revokes all sessions across devices when allSessions is set to true.

Auth

Requires a valid Bearer token.

Request Body

allSessions
boolean
default:false
Set to true to log out from all devices. Defaults to false (current session only).

Response

message
string
Confirmation message.
{
  "message": "Logged out successfully"
}

Errors

StatusCodeDescription
401AUTHENTICATION_ERRORMissing or invalid Bearer token

Example

curl -X POST https://api.bunship.com/api/v1/auth/logout \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{"allSessions": false}'
Logout from all devices:
curl -X POST https://api.bunship.com/api/v1/auth/logout \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{"allSessions": true}'