Preview workspace file content

Read browser preview content, converting Office documents to PDF when needed.

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

Before you call this API

Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5; use the corresponding product API URL for a dedicated deployment.

Prepare a personal access token for the target workspace. WORKSPACE_ID must match the path workspace; FILE_ID comes from actual file results. BASE_URL includes the product prefix in the same environment. Example files/IDs are placeholders.

Request parameters

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

No business request body. Set the path workspace and file ID to actual targets.

Original and converted content both have a 100 MiB preview limit. Office previews require a configured converter. HTML/HTM/SVG return as attachments; other applicable formats may render inline. Preview bytes may differ from the original download.

Successful response

sample

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.

Error responses

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

Unsupported formats return 400/2, preview size overflow 413/14, missing files 404/3, denied permissions 403/5, unavailable authorization 503/15, and conversion failures may return 500/1.

Last updated on