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

# 退出登录

> 撤销当前用户的访问与刷新令牌会话。

## POST /auth/logout

通过作废用户的全部刷新令牌来结束会话。须在请求头中携带有效的访问令牌。

<Warning>
  访问令牌在过期前（15 分钟内）仍可能有效。若需客户端侧立即完全退出，请同时清除本地保存的访问令牌。
</Warning>

### 请求头

<ParamField header="Authorization" type="string" required>
  Bearer 令牌。格式：`Bearer YOUR_ACCESS_TOKEN`
</ParamField>

### 响应

<ResponseField name="success" type="boolean">
  退出是否成功。
</ResponseField>

<ResponseField name="message" type="string">
  确认信息。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/auth/logout \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/auth/logout', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  });

  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "message": "Logout successful. All refresh tokens have been revoked."
  }
  ```

  ```json Unauthorized (401) theme={null}
  {
    "message": "Authorization header required"
  }
  ```
</ResponseExample>
