<span id="使用临时能力链接读取文件"></span>

# Read a file through a temporary capability link

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

Allow an external model provider to read one file through its issued link.

```text
GET https://api.moi.matrixorigin.cn/v5/catalog-files/{file_id}/content
```

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

## Before you call this API

First have an identity with read permission issue a model link. Set MODEL_FILE_URL to the complete returned url and use expires_at for expiration.

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

## Request parameters

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

```bash
curl --fail-with-body -sS -X GET "$MODEL_FILE_URL" \
  -o "$OUTPUT_FILE"
```

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | File ID in the path, matching the file bound to the signature. |
| `capability` | string | Yes | Query parameter appearing exactly once, using the value from the issued link. |

Access the issued url directly without a product PAT or workspace header. The signature binds workspace, file, and expiration seconds. Missing/invalid/expired signatures, unreadable files, and empty content all return public 404. Successful bytes include no-store, no-referrer, and related headers.

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

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

## Successful response

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

```text
sample
```

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

The response is a byte stream. Consume and close it, and check read/exit status before using the file. Failure after the response starts may interrupt the connection.

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

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

## Error responses

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

```json
{
  "code": "ErrNotFound",
  "msg": "示例本地化错误"
}
```

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

Public errors use string code/msg and hide internal signature/storage causes.

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