# Query the results of automated task execution

Read the result projection of an automated task running record.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agent-automation-runs/{run_id}/result
```

## Preparation before calling

Prepare to run the record ID, personal access token with access to the target workspace, and the target workspace ID.

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 the `X-Workspace-ID` Header and also as `workspace_id` in the path.
- `$RUN_ID`: The running record ID of the query result is used as `run_id` in the path.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agent-automation-runs/$RUN_ID/result" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | Workspace ID. |
| `run_id` | string | Yes | Run record ID. |

## Successful response

Returns `200` on success. When the operation has not ended, `status` should be used to determine whether to continue the query.

```json
{
  "code": 0,
  "data": {
    "run_id": "run_01",
    "automation_task_id": "task_01",
    "status": "succeeded",
    "final_text": "今日输入内容共 12 条，要点如下……",
    "structured_output": {},
    "output_validation_status": "passed",
    "artifact_refs": [],
    "completed_at": "2026-08-18T04:05:00Z"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.run_id` | string | Run and automation task ID. |
| `data.automation_task_id` | string | Run and automation task ID. |
| `data.status` | string | Current or final running status. |
| `data.result_url` | string | The result address returned when available. |
| `data.final_text` | string | The final text, structured output, and artifact references produced. |
| `data.structured_output` | object | The final text, structured output, and artifact references produced. |
| `data.artifact_refs` | array | The final text, structured output, and artifact references produced. |
| `data.output_validation_status` | string | Outputs the verification status and verification errors; does not return when verification does not occur. |
| `data.output_validation_error` | string | Outputs the verification status and verification errors; does not return when verification does not occur. |
| `data.error` | object | Details of the operation failure; can be returned when the operation fails. |
| `data.completed_at` | string | Run completion time, using RFC 3339 format; does not return if not yet completed. |

## Error response

```json
{
  "code": 3,
  "message": "<错误信息>"
}
```

### Common HTTP errors

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

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - The path parameter is invalid.
  - Check workspace and run ID.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Lack of valid identity credentials.
  - Check API Key.
* - `404`
  - `3`（`NOT_FOUND`）
  - The running record does not exist.
  - Query the running list first.
* - `503`
  - `15`（`UNAVAILABLE`）
  - The automated task service is unavailable.
  - Try again later.
```

## Follow-up operations

If you need to check the running process, [Query automation task running events](list-run-events.md).
