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

# 归档或取消归档聊天

> 归档或取消归档聊天对话。 已存档的聊天在主聊天列表中被隐藏。



## OpenAPI

````yaml /zh/openapi.yml post /chat/{chat_jid}/archive
openapi: 3.0.0
info:
  title: WhatsApp API 多设备
  version: 9.7.0
  description: |
    此 API 用于通过 API 发送什么应用。

    Web 仪表板是一个单独的项目(gowa-ui)； 服务器下载它的
    最新版本资产并在 `/` 处服务(或在
    APP_UI_ENABLED=false时返回一个 JSON 横幅)。

    设备范围：
    - 在所有设备范围的REST 调用上发送 `X-Device-Id` 。
    - WebSocket: 连接到"/w?device_id=<id>`.
    - WebSocket 身份验证（启用基本身份验证时）：浏览器无法为
      WebSocket 连接设置 Authorization 请求头，因此还需在
      查询字符串中传入 `&authorization=<base64(user:pass)>`。 在
      生产中使用TLS ，因为凭据在 URL 中可见。
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: 初始连接到 Whatsapp 服务器
  - name: device
    description: 多设备支持的设备管理
  - name: user
    description: 获取信息
  - name: send
    description: 发送消息 (Text/Image/File/Video)。
  - name: message
    description: 消息操作 (撤销/react/update)。
  - name: call
    description: 通话管理 (拒绝来电)
  - name: chat
    description: 聊天对话和消息
  - name: group
    description: 组设置
  - name: newsletter
    description: 通讯设置
  - name: chatwoot
    description: 客户支持的聊天窗口集成
paths:
  /chat/{chat_jid}/archive:
    post:
      tags:
        - chat
      summary: 归档或取消归档聊天
      description: 归档或取消归档聊天对话。 已存档的聊天在主聊天列表中被隐藏。
      operationId: archiveChat
      parameters:
        - $ref: '#/components/parameters/DeviceIdHeader'
        - in: path
          name: chat_jid
          schema:
            type: string
          required: true
          description: >-
            聊天 JID (e.g. phone@s.whatsapp.net for individ或groupid@g.us for
            group). 接受百分比编码值(如组%40g.us)。
          example: 6289685028129@s.whatsapp.net
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                archived:
                  type: boolean
                  example: true
                  description: 是归档(true) 还是取消归档(false)
              required:
                - archived
      responses:
        '200':
          description: 好的
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArchiveChatResponse'
        '400':
          description: 错误请求
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorUnauthorized'
        '404':
          description: 找不到聊天
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorNotFound'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInternalServer'
components:
  parameters:
    DeviceIdHeader:
      name: X-Device-Id
      in: header
      required: false
      description: |
        多设备支持的设备标识符。 当多个设备被注册时需要.
        如果只有一个设备被注册，它将被用作默认。
        也可以以 `device_id` 查询参数提供。
      schema:
        type: string
        example: my-device-id
  schemas:
    ArchiveChatResponse:
      type: object
      properties:
        status:
          type: integer
          example: 200
        code:
          type: string
          example: SUCCESS
        message:
          type: string
          example: Chat archived successfully
        results:
          type: object
          properties:
            status:
              type: string
              example: success
            message:
              type: string
              example: Chat archived successfully
            chat_jid:
              type: string
              example: 6289685028129@s.whatsapp.net
            archived:
              type: boolean
              example: true
    ErrorBadRequest:
      type: object
      properties:
        code:
          type: string
          example: 400
          description: HTTP 状态代码
        message:
          type: string
          example: field cannot be blank
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
    ErrorUnauthorized:
      type: object
      properties:
        code:
          type: string
          example: 401
          description: HTTP 状态代码
        message:
          type: string
          example: Unauthorized access
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
    ErrorNotFound:
      type: object
      properties:
        code:
          type: string
          example: 404
          description: HTTP 状态代码
        message:
          type: string
          example: Chat not found
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
    ErrorInternalServer:
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_SERVER_ERROR
          description: SYSTEM_CODE_ERROR
        message:
          type: string
          example: you are not loggin
          description: 详细错误消息
        results:
          type: object
          example: null
          description: 附加数据
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

## Related topics

- [固定或取消置顶聊天](https://gowa-docs.mintlify.site/zh/api-reference/chat/固定或取消置顶聊天.md)
- [从指定的聊天室获取消息](https://gowa-docs.mintlify.site/zh/api-reference/chat/从指定的聊天室获取消息.md)
- [API 参考](https://gowa-docs.mintlify.site/zh/api-reference/introduction.md)
- [Webhooks](https://gowa-docs.mintlify.site/zh/concepts/webhooks.md)
- [快速开始](https://gowa-docs.mintlify.site/zh/quickstart.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.