---
title: "WorkflowRun"
description: "The `WorkflowRun` entity."
section: "Reference"
group: "Types"
order: 276
---

## Definition

```ts
interface WorkflowRun {
  id: string;
  workspaceId: string;
  subjectId: string;
  parentRunId: string | null;
  status:
    | "pending"
    | "failed"
    | "running"
    | "completed"
    | "cancelled"
    | "timed_out"
    | "paused"
    | "waiting";
  mode: "sync" | "async";
  input: unknown;
  output: any;
  error: string | null;
  triggeredBy: "workflow" | "agent" | "swarm" | "user" | "event";
  cfWorkflowId: string | null;
  durationMs: number | null;
  userId: string;
  startedAt: string | null;
  completedAt: string | null;
  createdAt: string;
  updatedAt: string;
}
```

## Fields

| Field          | Type                                                                                                       | Notes                                                                        |
| -------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `id`           | `string`                                                                                                   | `readonly` `required`                                                        |
| `workspaceId`  | `string`                                                                                                   | `required` — Workspace this run belongs to.                                  |
| `subjectId`    | `string`                                                                                                   | `required` — Prefixed ID of the entity being run.                            |
| `parentRunId`  | `string \| null`                                                                                           | `required` — Parent run ID when this run was spawned from another.           |
| `status`       | `"pending" \| "failed" \| "running" \| "completed" \| "cancelled" \| "timed_out" \| "paused" \| "waiting"` | `required` — Run lifecycle status.                                           |
| `mode`         | `"sync" \| "async"`                                                                                        | `required` — Execution mode (sync, async/streaming, etc.).                   |
| `input`        | `unknown`                                                                                                  | `required` — Input payload submitted to the run.                             |
| `output`       | `any`                                                                                                      | `required` — Final output produced by the run, if successful.                |
| `error`        | `string \| null`                                                                                           | `required` — Error message when the run failed, otherwise null.              |
| `triggeredBy`  | `"workflow" \| "agent" \| "swarm" \| "user" \| "event"`                                                    | `required` — Origin of the run (user, trigger, parent run, scheduled, etc.). |
| `cfWorkflowId` | `string \| null`                                                                                           | `required` — Cloudflare Workflow instance ID, when the run used workflows.   |
| `durationMs`   | `number \| null`                                                                                           | `required` — Total duration in milliseconds, once the run finishes.          |
| `userId`       | `string`                                                                                                   | `required` — User on whose behalf the run executes.                          |
| `startedAt`    | `string \| null`                                                                                           | `required` — ISO-8601 timestamp when execution began.                        |
| `completedAt`  | `string \| null`                                                                                           | `required` — ISO-8601 timestamp when the run reached a terminal status.      |
| `createdAt`    | `string`                                                                                                   | `readonly` `required` — ISO-8601 timestamp of creation.                      |
| `updatedAt`    | `string`                                                                                                   | `readonly` `required` — ISO-8601 timestamp of the last update.               |
