Skip to navigation

Driver Logout (Single Device)

View as Markdown

Logs out the driver from the current device by revoking the specified refresh token in the database and incrementing the driver’s session version, immediately invalidating any associated access tokens.


Endpoint Overview

  • Method: POST

  • Route: /api/v1/driver/auth/logout

  • Authentication: None (Refresh Token in Body)

  • Content-Type: application/json


Request Headers

HeaderTypeRequiredDescription
Content-TypestringYesMust be application/json

Request Body Schema

FieldData TypeRequiredDefaultAllowed Values / ConstraintsDescription
refreshTokenstringYes—Min length 1 (prefixed with drtok_)Active refresh token of the current session

Example Request Body

{
"refreshToken": "drtok_7f8e9d0c1b2a345678901234567890ab"
}

Response Body Schema (200 OK)

Top-Level KeyData TypeDescription
messagestringLogout confirmation ("Driver logged out successfully")

Response Examples

1. 200 OK — Success

{
"message": "Driver logged out successfully"
}

2. 400 Bad Request — Validation Error (Missing refreshToken)

{
"success": false,
"message": "Validation failed: refreshToken: Refresh token is required",
"errors": [
{
"field": "refreshToken",
"message": "Refresh token is required"
}
]
}

3. 500 Internal Server Error

{
"error": "Failed to log out"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKRefresh token successfully revoked and session terminated.
400 Bad RequestMissing or empty refreshToken in request body.
500 Internal Server ErrorServer or database error while updating token records.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.