> ## Documentation Index
> Fetch the complete documentation index at: https://careerk.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Logout

> Invalidate the current refresh token and clear the authentication cookie

## Endpoint

```
POST /api/v1/auth/logout
```

**Base URL**: `http://localhost:3000/api/v1`

<Note>
  This endpoint does not use Bearer authentication. It requires the `refreshToken` cookie issued at
  login or email verification.
</Note>

## Authentication

Include the refresh token cookie with the request:

```bash theme={null}
Cookie: refreshToken=YOUR_REFRESH_TOKEN
```

If you call this endpoint from the browser, send credentials:

```ts theme={null}
fetch('/api/v1/auth/logout', {
  method: 'POST',
  credentials: 'include',
});
```

## Description

This endpoint:

* verifies the refresh token from the cookie
* invalidates it in storage
* clears the `refreshToken` cookie from the response

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true,
  "data": {},
  "message": "Logged out successfully",
  "meta": {
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/logout",
    "method": "POST"
  }
}
```

## Error Responses

### 401 Unauthorized - Refresh Token Not Found

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Refresh token not found",
    "statusCode": 401,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/logout",
    "method": "POST",
    "details": "Unauthorized"
  }
}
```

### 401 Unauthorized - Invalid Refresh Token

```json theme={null}
{
  "success": false,
  "error": {
    "message": "invalid token",
    "statusCode": 401,
    "timestamp": "2026-04-23T20:00:00.000Z",
    "path": "/auth/logout",
    "method": "POST",
    "details": "Unauthorized"
  }
}
```

## Notes

<Info>
  **Cookie-Based Logout**: This endpoint is tied to the refresh token cookie, not the access token
  in the Authorization header.
</Info>

<Tip>
  **Frontend**: After logout succeeds, clear any locally stored access token on the client side.
</Tip>

## Related Endpoints

* [Login](/api-reference/auth/login) - Create a new authenticated session
* [Refresh Token](/api-reference/auth/refresh-token) - Rotate the access token using the cookie
