---
orphan: true
---

# Query data assets in batches

Batch query of generated data assets by original file ID; unprocessed files will not appear in the results.

```text
POST https://moi.matrixorigin.cn/newmoi/catalog/data-assets/batch-get
```

## Preparation before calling

First [query the file list](list-files.md) to obtain the file ID. Prepare a list of personal access tokens, target workspace IDs, and file IDs 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`: Original file ID.

Empty file IDs in requests are ignored, and duplicate IDs are only processed as the first occurrence.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/data-assets/batch-get" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "raw_file_ids": ["'"$FILE_ID"'"]
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `raw_file_ids` | string[] | Yes | A list of original file IDs to query. |

`[]` after a type means an array. For example, `string[]` is an array of strings.

## Successful response

Returns `200` on success, `items` contains only processed file assets.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "items": [
      {
        "id": 1,
        "asset_id": "asset-01",
        "name": "orders.csv",
        "raw_file_id": "file-01",
        "volume_id": 10,
        "asset_type": "file"
      }
    ],
    "total": 1
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.items` | array | List of parsed data assets. |
| `data.items[].id` | integer | Data asset internal ID. |
| `data.items[].asset_id` | string | Data asset identifier. |
| `data.items[].name` | string | Data asset name. |
| `data.items[].raw_file_id` | string | ID of the corresponding source file. |
| `data.items[].volume_id` | integer | ID of the root volume that contains the file. |
| `data.items[].asset_type` | string | Data asset type. |
| `data.total` | integer | The number of data assets returned. |

## Error response

```json
{
  "code": "ErrParamInvalid",
  "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`
  - The file ID list is empty, exceeds the limit, or contains invalid values.
  - Provide a non-empty list of file IDs.
* - `403`
  - `ErrForbidden`
  - The current identity does not have read permission for the root volume that contains the file.
  - Use credentials with read permissions.
* - `500`
  - `ErrServer`
  - The server failed to query data assets.
  - Try again later.
```
