Preview source original file

Preview the original files associated with the knowledge base as a binary stream.

GET https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/sources/file/{file_id}/preview

Preparation before calling

file_id is the file ID of the original source file, not row_id in query data source list]. Prepare $AI_STUDIO_API_KEY, $WORKSPACE_ID, $MODEL_ID and $FILE_ID with read permissions on the target knowledge base.

Request example

curl -L "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID/sources/file/$FILE_ID/preview" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -o preview.bin

Successful response

Returns 200 and a file binary stream on success, without using a JSON response envelope.

Header

Description

Content-Type

File MIME type; application/octet-stream if not recognized.

Content-Disposition

Returns the inline preview file name if there is one.

Office files may be returned converted to PDF; ZIP source files may be returned with their Markdown content. So the response should be handled based on the actual Content-Type.

Common mistakes

HTTP Status Codes

Error Codes

Common Causes

Recommended Actions

400

ErrParamInvalid

model_id or file_id are not valid.

Use a non-empty file ID with no leading or trailing whitespace.

403

ErrForbidden

Does not have read permission for the target knowledge base.

Check workspace and knowledge base authorizations.

404

ErrNotFound

The file does not belong to a source accessible to this knowledge base.

Confirm the knowledge base ID and source document ID.

Follow-up operations

When you need to read segmentation, version and structured document information, use Query document details instead.

Last updated on