<span id="查询图纸来源与页面映射"></span>

# Get drawing provenance and page mappings

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

Read original provenance, visual manifest, and registered page images for a source file to check retrieval evidence.

```text
GET https://api.moi.matrixorigin.cn/v5/drawings/{source_file_id}/provenance
```

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

## Before you call this API

Set `MOI_ENDPOINT` to the product API prefix `https://api.moi.matrixorigin.cn/v5`. For private deployments, use the corresponding product API URL.

Use source_file_id from retrieval with the same knowledge base ID, workspace, and credentials. Requires knowledge base semantic_model.use. The path has no workspace_id but still requires X-Workspace-ID. source_file_id is neither drawing_number nor drawing_id.

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

## Request parameters

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

```bash
curl --get "$MOI_ENDPOINT/drawings/$SOURCE_FILE_ID/provenance" \
  --header "X-API-Key: $AI_STUDIO_API_KEY" --header "X-Workspace-ID: $WORKSPACE_ID" \
  --data-urlencode "knowledge_base_id=42" --data-urlencode "page_number=1"
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| source_file_id | Path | string | Yes | Source file ID from retrieval, path-encoded. |
| knowledge_base_id | Query | integer | Yes | Positive integer knowledge base ID. |
| page_number | Query | integer | No | Must be positive when supplied. Checks only that this page exists, while still returning all pages; not a single-page filter. Omit to skip existence checking. |

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

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

## Successful response

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

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "knowledge_base_id": 42,
    "source_file_id": "source-example",
    "external_source_uri": null,
    "visual_manifest_file_id": "manifest-example",
    "provenance_status": "ready",
    "gaps": [
      "external_origin_missing"
    ],
    "pages": [
      {
        "page_number": 1,
        "page_image_file_id": "page-1",
        "preview_url": "/semantic-models/42/artifacts/page-1/preview"
      },
      {
        "page_number": 2,
        "page_image_file_id": "page-2",
        "preview_url": "/semantic-models/42/artifacts/page-2/preview"
      }
    ]
  }
}
```

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

[Provenance objects and states](provenance-results.md) explains fields, ready/legacy, and gaps. ready does not guarantee every provenance field is complete;200 does not prove an arbitrary source_file_id exists or is downloadable.
:::::
::::::
:::::::

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

## Error response

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

```json
{
  "code": "ErrServiceUnavailable",
  "msg": "Service unavailable"
}
```

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

| Field | Type | Description |
| --- | --- | --- |
| code | string | Missing page404/ErrDrawingPageUnavailable; parameters400/ErrParamInvalid; see [Related APIs](index.md) for permissions/dependencies. |
| msg | string | Regular localized error text. The example above shows general dependency unavailability, not a missing-page error. |

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