# 在向量儲存中移除文件

{% openapi src="/files/WF90zszaISusKGEBimez" path="/vector-stores/{vector-store-id}/documents/{document-id}/" method="delete" %}
[rememberizer\_openapi.yml](https://2492455604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTVKmtXKPeA8gAZJsuGLA%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=3b4a9db2-4dd7-440f-b670-9555703d351d)
{% endopenapi %}

## 範例請求

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X DELETE \
  https://api.rememberizer.ai/api/v1/vector-stores/vs_abc123/documents/1234/ \
  -H "x-api-key: YOUR_API_KEY"
```

{% hint style="info" %}
將 `YOUR_API_KEY` 替換為您的實際向量存儲 API 金鑰，`vs_abc123` 替換為您的向量存儲 ID，`1234` 替換為文件 ID。
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const deleteDocument = async (vectorStoreId, documentId) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/${documentId}/`, {
    method: 'DELETE',
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });
  
  if (response.status === 204) {
    console.log("文件成功刪除");
  } else {
    console.error("刪除文件失敗");
  }
};

deleteDocument('vs_abc123', 1234);
```

{% hint style="info" %}
將 `YOUR_API_KEY` 替換為您的實際向量存儲 API 金鑰，`vs_abc123` 替換為您的向量存儲 ID，`1234` 替換為文件 ID。
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def delete_document(vector_store_id, document_id):
    headers = {
        "x-api-key": "YOUR_API_KEY"
    }
    
    response = requests.delete(
        f"https://api.rememberizer.ai/api/v1/vector-stores/{vector_store_id}/documents/{document_id}/",
        headers=headers
    )
    
    if response.status_code == 204:
        print("文件成功刪除")
    else:
        print(f"刪除文件失敗: {response.text}")

delete_document('vs_abc123', 1234)
```

{% hint style="info" %}
將 `YOUR_API_KEY` 替換為您的實際向量存儲 API 金鑰，`vs_abc123` 替換為您的向量存儲 ID，`1234` 替換為文件 ID。
{% endhint %}
{% endtab %}
{% endtabs %}

## 路徑參數

| 參數              | 類型 | 描述                     |
| --------------- | -- | ---------------------- |
| vector-store-id | 字串 | **必填。** 包含文件的向量存儲的 ID。 |
| document-id     | 整數 | **必填。** 要刪除的文件的 ID。    |

## 回應

成功的請求會返回 204 無內容狀態碼，並且沒有回應主體。

## 認證

此端點需要使用 `x-api-key` 標頭中的 API 金鑰進行認證。

## 錯誤回應

| 狀態碼 | 描述                  |
| --- | ------------------- |
| 401 | 未授權 - 無效或缺失的 API 金鑰 |
| 404 | 未找到 - 向量儲存或文件未找到    |
| 500 | 內部伺服器錯誤             |

此端點允許您從向量儲存中移除文件。一旦刪除，該文件及其向量嵌入將不再可用於搜索操作。這對於移除過時、不相關或敏感的內容非常有用。

{% hint style="warning" %}
警告：文件刪除是永久性的，無法撤銷。在刪除重要文件之前，請確保您有備份。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rememberizer.ai/zh-hk/kai-fa-zhe-zi-yuan/api-docs/vector-store/remove-a-document-in-vector-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
