> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/api-integration/endpoint-behaviors/conversation-attachments.md).

# 對話附件管理 API

使用檔案庫 API 查詢與刪除對話附件，並了解清單可見範圍與到期欄位。

當您需要查詢對話附件時，可使用對話附件 API。清單排除已直接連結檔案庫檔案的附件；自動歸檔會另外建立檔案庫項目，原對話附件仍可能出現在此清單。請勿只靠清單是否有該筆附件判定檔案是否已歸檔。附件如何上傳，請見 [Presigned 檔案上傳模式](/tech/api-integration/api_knowledge.md)。

## 存取條件與可見範圍 <a href="#access-and-visibility" id="access-and-visibility"></a>

請以 `Authorization: Api-Key <您的 API 金鑰>` 驗證身分；金鑰取得方式見[快速上手](/tech/api-integration/quickstart.md)。組織須已開通檔案庫，且呼叫者須具備檔案庫相關權限。組織擁有者可查看組織內符合上述條件的對話附件；其他成員只看得到自己曾在對話中傳送訊息的對話附件。清單按建立時間由新到舊排列。

## 端點 <a href="#endpoints" id="endpoints"></a>

`GET /api/v1/file-library/conversation-attachments/` 列出呼叫者可見的對話附件，`DELETE /api/v1/file-library/conversation-attachments/{id}/` 刪除一筆附件；參數與回應欄位見 API 文件[列出對話附件](https://docs.maiagent.ai/api/api-reference/fu-jian-he-dang-an#file-library-conversation-attachments-list)與[刪除對話附件](https://docs.maiagent.ai/api/api-reference/fu-jian-he-dang-an#file-library-conversation-attachments-destroy)。

`{id}` 是清單回傳的附件 ID。刪除會一併移除未共用的儲存檔案，請先確認選中的附件；若其他附件或檔案仍使用同一個儲存物件，該物件會保留。

## 分頁與清單欄位 <a href="#list-fields" id="list-fields"></a>

清單每頁預設 20 筆，可用 `pageSize`（也可寫 `page_size`）調整，最多 100 筆。附件放在回應的 `results`，請持續依 `next` 網址讀取下一頁，直到 `next` 為 `null`；不要只讀第一頁。

每筆附件的欄位見 API 文件[列出對話附件](https://docs.maiagent.ai/api/api-reference/fu-jian-he-dang-an#file-library-conversation-attachments-list)。`conversationId` 可供串接端對回來源對話。`expiresAt` 是依清理設定計算的到期時間，格式為 ISO 8601 字串（和 `createdAt` 的毫秒時間戳記不同），未設定清理生效時間時為 `null`；若對話已有最後訊息時間，到期時間以該時間為基準，否則以附件建立時間為基準。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/tech/api-integration/endpoint-behaviors/conversation-attachments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
