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

# 获取分析模型

> 通过 ID 或自定义 ID 获取分析模型

```
GET /openapi/memorylake/api/v3/workspaces/{workspaceId}/analysis-models/{modelId}
```

通过 ID 获取分析模型。如需用创建时设置的 `custom_id` 查找，请把 `by_custom_id` 设为 `true`，并把自定义 ID 作为路径参数传入。

如需读取模型包含的知识，请调用[列出知识条目](https://docs.memorylake.cn/features/memorylake/api-reference/database/analysis-models/list-knowledge-entries.md)。

> [!NOTE]
>
> **所需权限：** `analysis_model:read`

### 路径参数

**workspaceId** `string` *required*

工作空间 ID

**modelId** `string` *required*

分析模型 ID；当 `by_custom_id` 为 `true` 时为模型的 `custom_id`

### 查询参数

**by\_custom\_id** `boolean` (default: false)

设为 `true` 时按 `custom_id` 而不是 ID 查找模型

```bash By model ID theme={null}
curl -X GET 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-8001856949ad4f6a5b6226f415ffa877/analysis-models/am-9d3f7b1e5a2c4d8f6b0e3a7c9d1f5b2e' \
  -H 'Authorization: Bearer sk_xxxxxx'
```

```bash By custom ID theme={null}
curl -X GET 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-8001856949ad4f6a5b6226f415ffa877/analysis-models/sales-qa?by_custom_id=true' \
  -H 'Authorization: Bearer sk_xxxxxx'
```

### 响应

**data** `object`

**分析模型对象**

**id** `string`

分析模型标识符，请把它当作不透明字符串处理。

**name** `string`

显示名称

**description** `string`

自由格式的描述

**type** `string`

模型遵循的模板，例如 `ASK_DATA`。它决定模型接受哪些类型的知识。

**schemas** `array`

模型覆盖的 schema，继承自其数据源

**custom\_id** `string`

您为这个模型设置的自定义标识符（如果设置过）

**db\_datasource\_id** `string`

模型所基于的数据源

**workspace\_id** `string`

模型所属的工作空间

**fork\_from** `string`

这个模型派生自的源模型。从零创建的模型不返回该字段。它只是来源记录，不是依赖：源模型被删除后它仍指向源模型，此时用这个 ID 查询会返回「未找到」。

**created\_at** `string`

创建时间戳

**updated\_at** `string`

最后更新时间戳

```json Success (200) theme={null}
{
  "success": true,
  "data": {
    "id": "am-9d3f7b1e5a2c4d8f6b0e3a7c9d1f5b2e",
    "name": "Sales Q&A",
    "description": "Answers questions about orders and revenue",
    "type": "ASK_DATA",
    "schemas": ["sales"],
    "custom_id": "sales-qa",
    "db_datasource_id": "dbds-4b8e2f6a1c9d4e7b8a3f5c2d6e9b1a7c",
    "workspace_id": "ws-8001856949ad4f6a5b6226f415ffa877",
    "created_at": "2026-09-21T09:14:05.612Z",
    "updated_at": "2026-09-21T09:14:05.618Z"
  }
}
```


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