# Read an operation

URL: https://heaven.dev/docs/reference/operations/read
Updated: 2026-11-21

Read an accepted change's state and result by operation ID. Use `wait: true` to wait until it completes, fails or is superseded. If the wait expires while the change is still in progress, read the same operation again.

`GET /v1/operation/`

## Parameters

- `operation` (string, required): Operation ID returned when the change was accepted.
- `wait` (boolean): Wait up to `timeout` for the operation to finish. Omit to read its current state immediately.
- `timeout` (string): Time to wait with `wait: true`, in duration form such as 30s. Defaults to 10s. Maximum 10m.

## Returns

- `data` (object, always present): The current state of an operation or operation group.
  - `alternative-1` (object): The current state of a Computer operation.
    - `operation` (object, always present): Operation you requested, including any recorded failure.
      - `by` (string): Requester's email address, or user ID if no email is recorded. Omitted for your own requests. May be omitted.
      - `completed_at` (string (date-time)): When the operation reached its final state. Absent while unfinished. May be omitted.
      - `computer_id` (string, always present): Computer's stable ID.
      - `created_at` (string (date-time)): When Heaven accepted the change. May be omitted.
      - `error_code` (string): Recorded failure code. May be omitted.
      - `id` (string, always present): Operation ID for `operation view`.
      - `kind` (string, always present): Change being tracked.
      - `message` (string): An explanation of the recorded failure and any next action. May be omitted.
      - `state` (string, always present): `accepted` means saved and unfinished. `complete` means the change finished. `failed` means it could not finish. `superseded` means a newer change replaced it before completion. Values: `"accepted"`, `"complete"`, `"failed"`, `"superseded"`.
  - `alternative-2` (object): The current state of a grouped change.
    - `operation` (object, always present): Group and the operations or steps that determine its outcome.
      - `completed_at` (string (date-time)): When the group finished. Absent while unfinished. May be omitted.
      - `created_at` (string (date-time), always present): When the grouped change was accepted.
      - `id` (string, always present): Group ID for `operation view`.
      - `kind` (string, always present): Grouped change.
      - `message` (string): An explanation of the group's progress or failure. May be omitted.
      - `operations` (object[] | null, always present): Member Computer operations.
        - `items` (object): An accepted change to one Computer. Work continues after the request disconnects.
          - `by` (string): Requester's email address, or user ID if no email is recorded. Omitted for your own requests. May be omitted.
          - `completed_at` (string (date-time)): When the operation reached its final state. Absent while unfinished. May be omitted.
          - `computer_id` (string, always present): Computer's stable ID.
          - `created_at` (string (date-time)): When Heaven accepted the change. May be omitted.
          - `error_code` (string): Recorded failure code. May be omitted.
          - `id` (string, always present): Operation ID for `operation view`.
          - `kind` (string, always present): Change being tracked.
          - `message` (string): An explanation of the recorded failure and any next action. May be omitted.
          - `state` (string, always present): `accepted` means saved and unfinished. `complete` means the change finished. `failed` means it could not finish. `superseded` means a newer change replaced it before completion. Values: `"accepted"`, `"complete"`, `"failed"`, `"superseded"`.
      - `pool_id` (string): Pool this change concerns. May be omitted.
      - `state` (string, always present): `accepted` while work remains, `complete` when all work succeeds, or `failed` when a step fails or a member operation fails or is superseded. Values: `"accepted"`, `"complete"`, `"failed"`, `"superseded"`.
      - `steps` (object[]): Other steps, in execution order. May be omitted.
        - `items` (object): A step in a grouped change outside its Computer operations.
          - `kind` (string, always present): Action taken by this step.
          - `message` (string): Progress or failure details for this step. May be omitted.
          - `pool_id` (string): Affected pool's ID. May be omitted.
          - `state` (string, always present): Step's recorded progress or outcome.
          - `subject` (string): Affected object, such as an organization being left. May be omitted.
      - `subject` (string): Other object the change concerns, such as a pool snapshot's name. May be omitted.

## Errors

Each code is explained in full at https://heaven.dev/docs/reference/errors.

| Code | Status | What happened |
|---|---:|---|
| `invalid` | 400 | An input is missing or invalid. |
| `unauthenticated` | 401 | The credential is missing, invalid, expired or revoked. |
| `denied` | 403 | The caller lacks permission for this action. |
| `not_found` | 404 | The resource is absent or inaccessible to this caller. |
| `conflict` | 409 | The request conflicts with the current resource state or an earlier request. |
| `over_capacity` | 409 | The request exceeds a resource or credential allowance. |
| `access_list_full` | 409 | The change would exceed the access-list allowance. |
| `rate_limited` | 429 | The caller's request rate exceeds its limit. |
| `busy` | 429 | Too much work is in progress to accept this request. |
| `unknown` | 503 | The outcome is unconfirmed; a change may have happened. |
| `unavailable` | 503 | The service or requested feature is unavailable. |

## Notes

- API key permission: `operation view`.

## Examples

```sh tab="heaven CLI"
heaven operation view OPERATION
  [--wait]
  [--timeout DURATION]
```

```sh tab="SSH"
ssh cli@heaven.dev operation view OPERATION
  [--wait]
  [--timeout DURATION]
```

```sh tab="cURL"
curl "https://heaven.dev/v1/operation/?operation=1c6f3a9e-8d2b-4e75-a041-6b9c2e7d3f18" \
  -H "Authorization: Bearer $HEAVEN_API_KEY"
```

```json tab="MCP"
{ "tool": "operation_view",
  "arguments": { "operation": "1c6f3a9e-8d2b-4e75-a041-6b9c2e7d3f18" } }
```

Response:

```json title="Response excerpt"
{
  "version": 1,
  "data": {
    "operation": {
      "completed_at": "2026-11-16T12:00:00Z",
      "created_at": "2026-11-16T12:00:00Z",
      "id": "1c6f3a9e-8d2b-4e75-a041-6b9c2e7d3f18",
      "kind": "create",
      "state": "complete"
    }
  }
}
```
