> ## 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 检索单个文档的元数据

```
GET /openapi/memorylake/api/v3/workspaces/{workspaceId}/projects/{projectId}/memories/documents/{documentId}
```

返回单个项目文档的元数据。使用此接口可以检查最近导入的文档是否已完成处理、查看其 token 用量，或在执行其他操作前确认其存在。

<Note>
  **所需权限：** `project:doc_read`
</Note>

### 路径参数

<ParamField path="workspaceId" type="string" required>
  拥有该项目的工作空间 ID。
</ParamField>

<ParamField path="projectId" type="string" required>
  文档所属的项目。
</ParamField>

<ParamField path="documentId" type="string" required>
  要检索的文档 ID。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-a1b2c3d4e5f6/projects/proj-7g8h9i0j1k2l/memories/documents/doc-3m4n5o6p7q8r' \
    -H 'Authorization: Bearer sk_xxxxxx'
  ```
</RequestExample>

### 响应

<ResponseField name="data" type="object">
  <Expandable title="文档详情">
    <ResponseField name="id" type="string">文档 ID。</ResponseField>
    <ResponseField name="name" type="string">文档的文件名。</ResponseField>
    <ResponseField name="status" type="string">处理状态：`pending`、`running`、`okay` 或 `error`。</ResponseField>
    <ResponseField name="error" type="object|null">当 `status` 为 `error` 时的错误详情。否则为 `null`。</ResponseField>

    <ResponseField name="usage" type="object">
      处理的 token 用量。

      <Expandable title="Usage">
        <ResponseField name="files_process_tokens" type="integer">处理此文档消耗的 token 数量。</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="document_type" type="string">文档类型：`drive_file`。</ResponseField>
    <ResponseField name="created_at" type="string">文档导入时的 ISO 8601 时间戳。</ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "data": {
      "id": "doc-3m4n5o6p7q8r",
      "name": "quarterly-report.pdf",
      "status": "okay",
      "error": null,
      "usage": {
        "files_process_tokens": 15230
      },
      "document_type": "drive_file",
      "created_at": "2025-03-10T14:22:00Z"
    }
  }
  ```
</ResponseExample>
