> ## 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.

# 命名空间

> 列出、获取、创建和删除命名空间：命名的文档集合，例如 docs 或 user-42。

命名空间是一个命名的文档集合；首次写入时会创建它，为每个用户分配一个命名空间可隔离用户数据。

## 列出命名空间

`GET /namespaces`

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

```ts TypeScript theme={null}
await conare.namespaces({ prefix: "user-" });
```

```json Response theme={null}
{
  "namespaces": [
    {
      "name": "user-42",
      "documents": 2,
      "embedding_model": "conare-embed-1",
      "rerank_model": "conare-rerank-1",
      "created_at": "2026-10-21T21:38:52.859567Z",
      "updated_at": "2026-10-21T21:38:52.895Z",
      "last_query_at": "2026-10-21T21:38:54.56266Z"
    }
  ]
}
```

| 选项 | 类型 | 作用 |
| - | - | - |
| `prefix` | string | 仅返回名称以此开头的命名空间 |

| 字段 | 含义 |
| - | - |
| `name`, `documents` | 命名空间及其包含的文档数 |
| `embedding_model`, `rerank_model` | 其使用的模型 |
| `created_at` | 创建时间；2026-10-18 之前的为其最早文档的写入时间（不含文档时为 `null`） |
| `updated_at` | 最后一次写入时间 |
| `last_query_at` | 最后一次搜索时间，最多每分钟记录一次；自 2026-10-18 起未被搜索则为 `null` |

完整 schema：[列出命名空间](https://docs.conare.ai/zh/api-reference/namespaces/list-namespaces.md)。

## 获取命名空间

`GET /namespaces/:namespace`

返回包含相同字段的单个命名空间，或返回 `404 namespace_not_found`。

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

完整 schema：[获取命名空间](https://docs.conare.ai/zh/api-reference/namespaces/get-a-namespace.md)。

## 创建命名空间

`POST /namespaces`

仅在使用为你的组织训练的模型时需要：请在首次写入前创建命名空间。

```bash curl theme={null}
curl https://api.conare.ai/namespaces \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "contracts", "embedding_model": "<your model id>"}'
```

| 选项 | 类型 | 作用 |
| - | - | - |
| `name` | string，必填 | 1-64 个 `a-z 0-9 _ -` 字符，以字母或数字开头 |
| `embedding_model` | string | 你的 [模型](https://docs.conare.ai/zh/embed-rerank.md#模型) id；默认为 `conare-embed-1` |

返回 `name`、`embedding_model` 和 `rerank_model`；再次创建已有命名空间会返回相同结果。完整 schema：[创建命名空间](https://docs.conare.ai/zh/api-reference/namespaces/create-a-namespace.md)。

## 删除命名空间

`DELETE /namespaces/:namespace`

删除命名空间、其所有文档及其 [上传的文件](https://docs.conare.ai/zh/files.md)；此操作无法撤销。

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

```ts TypeScript theme={null}
await conare.namespace("docs").drop();
```

```json Response theme={null}
{ "deleted": true, "sources_deleted": ["src_01139ca8ca59f2556f65b60e"] }
```

| 选项 | 类型 | 作用 |
| - | - | - |
| `force` | boolean，默认 `false` | 同时删除写入该命名空间的 [数据源](https://docs.conare.ai/zh/sources.md) |

* 不使用 `force` 时，若有已连接的应用或存储桶写入该命名空间，会返回 `409 namespace_has_sources`，其 id 位于 `details.source_ids`。
* `sources_deleted` 列出随之删除的数据源；每个删除完成后，`GET /sources/:id` 会显示 `deleted`。

完整 schema：[删除命名空间](https://docs.conare.ai/zh/api-reference/namespaces/delete-a-namespace.md)。


## Related topics

- [搜索](https://docs.conare.ai/zh/query.md)
- [MCP](https://docs.conare.ai/zh/mcp-server.md)
- [控制台](https://docs.conare.ai/zh/console.md)
- [获取、列出和删除文档](https://docs.conare.ai/zh/documents.md)
- [写入文档](https://docs.conare.ai/zh/write.md)


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