API: Logout

Request

This is a POST request to log out the authenticated user. You must be authenticated to call this endpoint.

POST /api/logout

Sample Response:


{
  "status": "error",
  "code": 401,
  "message": "Unauthenticated",
  "data": "Unauthenticated request. Please log in to access this resource."
}
                

Response Explanation:

  • status: The status of the request. "error" indicates the user is not authenticated.
  • code: The HTTP status code. Here it's `401`, indicating that the request is unauthorized.
  • message: A message explaining why the request failed (in this case, due to unauthenticated access).
  • data: A description providing additional details on why the request was unsuccessful (in this case, the user needs to be logged in).

Notes:

  • You must be logged in to access this endpoint. If you're not authenticated, you will receive a `401 Unauthorized` response.
  • The logout action invalidates the user's session or token.