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

> ## Agent Instructions
> Conare's API is at https://api.conare.ai. Authenticate with `Authorization: Bearer $CONARE_API_KEY`.
> The full OpenAPI spec is at https://api.conare.ai/openapi.yaml; each endpoint has a page under /api-reference, and appending .md to any page URL returns its Markdown.
> Embed with model conare-embed-1; send input_type "query" for search queries. Rerank with conare-rerank-1.
> Prefer the TypeScript SDK (`npm install conare`) or plain HTTP in examples.
> Install the Conare skill with `npx skills add https://docs.conare.ai`; search these docs over MCP at https://docs.conare.ai/mcp; the whole site is at https://docs.conare.ai/llms-full.txt.

# 获取、列出和删除文档

> 通过 GET 和 DELETE 请求读取单个文档、逐页列出命名空间中的文档，以及按 id 删除单个文档或按过滤条件批量删除文档。

要删除命名空间中的所有内容，请 [删除该命名空间](https://docs.conare.ai/zh/namespaces.md#删除命名空间)。

## 获取文档

`GET /namespaces/:namespace/documents/:id`

返回包含完整文本的单个文档，或返回 `404 document_not_found`。

```bash curl theme={null}
curl https://api.conare.ai/namespaces/docs/documents/refunds \
  -H "Authorization: Bearer $CONARE_API_KEY"
```

```ts TypeScript theme={null}
const doc = await docs.get("refunds"); // null if it doesn't exist
```

```json Response theme={null}
{
  "id": "refunds",
  "text": "Refunds are available for 30 days.",
  "metadata": { "team": "support" },
  "updated_at": "2026-10-21T21:38:52Z",
  "version": 1
}
```

| 字段 | 含义 |
| - | - |
| `id`, `text`, `metadata` | 文档本身 |
| `updated_at` | 最后一次变更的时间（UTC） |
| `version` | 每次变更时递增 |
| `user`, `seq` | 设置时，与 [写入](https://docs.conare.ai/zh/write.md) 时一致 |

完整 schema：[获取文档](https://docs.conare.ai/zh/api-reference/documents/get-a-document.md)。

## 列出文档

`GET /namespaces/:namespace/documents`

按 id 顺序返回文档，不含文本。

```bash curl theme={null}
curl "https://api.conare.ai/namespaces/docs/documents?limit=100" \
  -H "Authorization: Bearer $CONARE_API_KEY"
```

```ts TypeScript theme={null}
for await (const doc of docs.list()) {
  console.log(doc.id, doc.version); // reads every page
}
```

```json Response theme={null}
{
  "documents": [
    { "id": "refunds", "metadata": { "team": "support" }, "updated_at": "2026-10-21T21:38:52Z", "version": 1 },
    { "id": "shipping", "metadata": { "team": "ops" }, "updated_at": "2026-10-21T21:38:52Z", "version": 1 }
  ],
  "next_cursor": null
}
```

| 选项 | 类型 | 作用 |
| - | - | - |
| `limit` | integer，默认 50 | 每页文档数，1-100 |
| `cursor` | string | 上一页的 `next_cursor`，最后一页时为 `null` |

完整 schema：[列出文档](https://docs.conare.ai/zh/api-reference/documents/list-documents.md)。

## 删除文档

`DELETE /namespaces/:namespace/documents/:id`

删除单个文档，或返回 `404 document_not_found`。

```bash curl theme={null}
curl -X DELETE https://api.conare.ai/namespaces/docs/documents/refunds \
  -H "Authorization: Bearer $CONARE_API_KEY"
```

```ts TypeScript theme={null}
await docs.delete("refunds");
```

```json Response theme={null}
{ "deleted": true }
```

完整 schema：[删除文档](https://docs.conare.ai/zh/api-reference/documents/delete-a-document.md)。

## 批量删除

`POST /namespaces/:namespace/documents/delete`

删除一组 id，或删除过滤条件匹配的所有文档：发送 `ids` 或 `filter`，不能同时发送。

```bash curl theme={null}
curl https://api.conare.ai/namespaces/docs/documents/delete \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["refunds", "shipping"]}'

curl https://api.conare.ai/namespaces/docs/documents/delete \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filter": {"team": "support"}}'
```

```ts TypeScript theme={null}
await docs.deleteMany(["refunds", "shipping"]); // how many were deleted
await docs.deleteWhere({ team: "support" });    // repeats until done
```

```json Response theme={null}
{ "deleted": 2, "more": false }
```

| 选项 | 类型 | 作用 |
| - | - | - |
| `ids` | array | 1-1,000 个文档 id；不存在的 id 会被跳过 |
| `filter` | object | [过滤条件](https://docs.conare.ai/zh/filters.md)，不支持 `$ne` 或 `$nin` |

* `deleted` 表示本次调用删除的数量。
* 过滤条件会分批删除：只要 `more` 为 `true`，就再次发送请求。

> [!WARNING]
>
> 拼写错误的过滤键不会匹配任何内容，因此不会删除任何文档。

完整 schema：[按 id 或过滤条件删除文档](https://docs.conare.ai/zh/api-reference/documents/delete-documents-by-id-or-filter.md)。


## Related topics

- [命名空间](https://docs.conare.ai/zh/namespaces.md)
- [MCP](https://docs.conare.ai/zh/mcp-server.md)
- [数据源](https://docs.conare.ai/zh/sources.md)
- [turbopuffer API](https://docs.conare.ai/zh/turbopuffer.md)
- [文件](https://docs.conare.ai/zh/files.md)


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