# Preview analysis products

Preview the products generated by knowledge base file parsing, such as parsing images, in a binary stream.

```text
GET https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/artifacts/{file_id}/preview
```

## Preparation before calling

Prepare `$AI_STUDIO_API_KEY`, `$WORKSPACE_ID`, `$MODEL_ID` and `$FILE_ID` with read permissions on the target knowledge base. This `file_id` must be the parsing product associated with the source file of the knowledge base; knowing only a Catalog file ID cannot be used as a preview basis.

## Request example

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

## Successful response

Returns `200` and the product binary stream on success, without using a JSON response envelope.

| Header | Description |
| --- | --- |
| `Content-Type` | Product MIME type; `application/octet-stream` if not recognized. |
| `Content-Disposition` | Returns the inline preview file name if there is one. |

## 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 product file ID with no leading or trailing spaces. |
| `403` | `ErrForbidden` | Does not have read permission for the target knowledge base. | Check workspace and knowledge base authorizations. |
| `404` | `ErrNotFound` | The product is not associated with the source file of this knowledge base. | Confirm the knowledge base ID and analytical product ID. |

## Follow-up operations

When you need to view the original source file, use [Preview source original file](preview-source-file.md).
