<span id="查询工作区文件元数据"></span>

# Get workspace file metadata

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Read workspace file metadata by file ID.

```text
GET https://api.moi.matrixorigin.cn/v5/workspaces/{id}/files/{file_id}
```

<span id="调用前准备"></span>

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

Prepare a personal access token for the target workspace. WORKSPACE_ID must match the path workspace, and FILE_ID must come from actual file results. BASE_URL includes the same environment's product prefix. Example files/IDs are placeholders.

<span id="请求参数"></span>

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --fail-with-body -sS -X GET "$BASE_URL/workspaces/$WORKSPACE_ID/files/$FILE_ID" \
  -H "X-API-Key: $MOI_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameters

No business request body. Use the actual target workspace and file ID in the path.

Success uses numeric code=0. Source conversation/task/call/tool fields are hidden according to visibility; missing fields do not imply no source.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 0,
  "data": {
    "file_id": "file-example",
    "original_name": "sample.txt",
    "size": 7,
    "md5": "5177a58dc65c8a14dc90c69db3bf3dd2",
    "ref_count": 1,
    "created_at": 1794390000,
    "created_by": "user-example",
    "updated_at": 1794390001,
    "source": "user_upload",
    "content_type": "text/plain",
    "storage_mode": "managed"
  }
}
```

:::::
:::::{tab-item} Fields

Success uses numeric code=0 with [17-field metadata](objects.md#metadata) in data; scalar zero values may be omitted.

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 2,
  "message": "示例错误信息"
}
```

:::::
:::::{tab-item} Fields

Missing business objects return 404/3, permission denial403/5, and unavailable authorization dependencies503/15. Handle numeric code/message separately from list string envelopes.

:::::
::::::
:::::::
