# Query running records

Lists the running record of an import task to confirm the status and processing scope of each execution of the task.

```text
GET https://moi.matrixorigin.cn/newmoi/task/runs?task_id=$TASK_ID
```

## Before you call

Prepare the personal access token, target workspace ID, and task 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`: The workspace ID of the task to be queried, passed through the `X-Workspace-ID` Header.
- `$TASK_ID`: Import task ID.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/task/runs?task_id=$TASK_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Query parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `task_id` | string | Yes | The ID of the import task to query the running records. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.

## Successful response

Returns `200` on success.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "runs": [
      {
        "id": "run_01",
        "import_task_id": "task_01",
        "workflow_execution_id": "exec_01",
        "status": 2,
        "row_count": 100,
        "file_count": 1,
        "started_at": "2026-08-18T10:00:00Z",
        "ended_at": "2026-08-18T10:01:00Z"
      }
    ],
    "total": 1
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.runs` | object[] | Import task running records. |
| `data.runs[].id` | string | Run ID. |
| `data.runs[].import_task_id` | string | The ID of the import task. |
| `data.runs[].workflow_app_id` | string | Associated workflow application ID; may be omitted if not associated. |
| `data.runs[].workflow_execution_id` | string | The associated workflow execution ID; may be omitted if not associated. |
| `data.runs[].status` | integer | Run status code: `1` Created, `2` Running, `3` Completed, `4` Failed, `5` Canceled. |
| `data.runs[].error_message` | string | Failure message; may be omitted if there is no error. |
| `data.runs[].row_count` | integer | The number of rows processed in this run. |
| `data.runs[].file_count` | integer | The number of files processed in this run. |
| `data.runs[].started_at` | string | Start time; may be omitted if not recorded. |
| `data.runs[].ended_at` | string | End time; may be omitted if not recorded. |
| `data.runs[].created_at` | string | Run record creation time; may be omitted if not recorded. |
| `data.runs[].updated_at` | string | The last update time of the running record; it may be omitted if it is not recorded. |
| `data.total` | integer | Total number of running records. |

## Error response

```json
{
  "code": "ErrParamInvalid",
  "msg": "task_id is required",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 25 30 33

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - Missing or invalid `task_id` used.
  - Pass in the task ID and confirm that the task belongs to the current workspace.
* - `200`
  - `ErrServer`
  - The service failed to query the running records.
  - Check both HTTP status and `code`.
```

## Follow-up operations

Combine with [Query Task Files](list-import-task-files.md) to locate the failure range.
