# Query automation task details

Read the current configuration and execution summary of an automated task.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agent-automation-tasks/{automation_task_id}
```

## Preparation before calling

First [query the automation task list](list-tasks.md) to obtain the task ID. Prepare a personal access token and target workspace ID that has 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 the `X-Workspace-ID` Header and also as `workspace_id` in the path.
- `$TASK_ID`: The automation task ID to query, as `automation_task_id` in the path.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agent-automation-tasks/$TASK_ID" \
  -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. |
| `automation_task_id` | string | Yes | Automation task ID. |

## Successful response

Returns `200` on success. The plan trigger can return `next_trigger_at` when calculating the next execution; `last_run_summary` can be returned when there are already execution records.

```json
{
  "code": 0,
  "data": {
    "id": "task_01",
    "workspace_id": "ws_01",
    "agent_workspace_id": "ws_01",
    "name": "每日摘要",
    "agent_id": "agent_01",
    "instruction_text": "汇总当天的输入内容。",
    "trigger": {
      "mode": "cron",
      "cron_expression": "0 9 * * *"
    },
    "status": "active",
    "version": 1,
    "created_at": "2026-08-18T01:00:00Z",
    "updated_at": "2026-08-18T01:00:00Z"
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.id` | string | Task, workspace and target agent identification. |
| `data.workspace_id` | string | Task, workspace and target agent identification. |
| `data.agent_workspace_id` | string | Task, workspace and target agent identification. |
| `data.agent_id` | string | Task, workspace and target agent identification. |
| `data.name` | string | Task name, description and fixed instructions. |
| `data.description` | string | Task name, description and fixed instructions. |
| `data.instruction_text` | string | Task name, description and fixed instructions. |
| `data.trigger` | object | Trigger configuration; contains `mode` and the fields required by the mode. |
| `data.auth_policy` | object | Authentication policy and structured output constraints; not returned if not set. |
| `data.output_contract` | object | Authentication policy and structured output constraints; not returned if not set. |
| `data.status` | string | Task status and current version. |
| `data.version` | integer | Task status and current version. |
| `data.next_trigger_at` | string | Next scheduled trigger time; returned when computable, using RFC 3339 format. |
| `data.last_run_summary` | object | Summary of the latest run; can be returned if a run record exists. |
| `data.execution` | object | Task execution plan. |
| `data.created_at` | string | Creation and last update times, using RFC 3339 format. |
| `data.updated_at` | string | Creation and last update times, using RFC 3339 format. |

## 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 task IDs.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Lack of valid identity credentials.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity cannot read the agent associated with the task.
  - Check workspace and agent authorizations.
* - `404`
  - `3`（`NOT_FOUND`）
  - The automated task does not exist.
  - Check the task list first.
* - `503`
  - `15`（`UNAVAILABLE`）
  - Automation task services or agent summary projection dependencies are not available.
  - Try again later.
```

## Follow-up operations

[Update automated tasks](update-task.md) according to the current configuration, or start a task and query the corresponding running details.
