# Query data assets

Query the corresponding data assets after processing according to the original file ID.

```text
GET https://moi.matrixorigin.cn/newmoi/catalog/files/{file_id}/data-asset
```

## Preparation before calling

First [query the file list](list-files.md) to obtain the original file ID. Prepare the personal access token, target workspace ID, and file ID that have access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through `X-Workspace-ID` Header.
- `$FILE_ID`: To query the original file ID of the data asset.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/catalog/files/$FILE_ID/data-asset" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Description |
| --- | --- | --- |
| `file_id` | string | Original file ID. |

## Successful response

Returns `200` and data asset information on success. `404` is returned when the file has not been processed into a data asset, and the interface will not automatically create data assets.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "asset": {
      "id": 1,
      "asset_id": "asset-123",
      "name": "orders.csv",
      "volume_id": 789,
      "asset_type": "file",
      "asset_ref": "file-123"
    },
    "derivations": [],
    "assets_by_id": {}
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.asset` | object | The data asset corresponding to the original file. |
| `data.asset.id` | integer | Data asset internal ID. |
| `data.asset.asset_id` | string | Data asset ID. |
| `data.asset.name` | string | Asset name. |
| `data.asset.volume_id` | integer | The volume ID to which it belongs. |
| `data.asset.asset_type` | string | Data asset type. |
| `data.asset.asset_ref` | string | Data asset reference identifier. |
| `data.asset.source` | string | Data asset source. |
| `data.asset.meta` | object | Data asset extended metadata. |
| `data.asset.created_at` | integer | Unix timestamp of creation time in seconds. |
| `data.asset.updated_at` | integer | Unix timestamp of the update time in seconds. |
| `data.derivations` | array | Asset derivation relationship. |
| `data.manifest` | object | Mapping metadata between original file and parsed product; may be omitted if not available. |
| `data.assets_by_id` | object | Related assets indexed by asset ID. |

## Error response

```json
{
  "code": "ErrNotFound",
  "msg": "对象不存在",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - `file_id` in path is missing or invalid.
  - Pass in a valid original file ID.
* - `403`
  - `ErrForbidden`
  - The current identity does not have read permission on the root volume to which it belongs.
  - Use credentials with read access, or contact your administrator for authorization.
* - `404`
  - `ErrNotFound`
  - The file does not exist, or the file has not generated data assets.
  - Check the file ID; if you need a product, please complete the corresponding process first.
* - `500`
  - `ErrServer`
  - The service cannot parse the data asset.
  - Record the request time and error message and try again; if it continues to fail, contact support.
```

## Follow-up operations

When modifications are needed [Update database](update-database.md). When returning the list [Query file products](list-file-artifacts.md).
