Runs

REST endpoints for runs. Bearer-auth required.

GET /api/runs

List runs with pagination and optional filtering.

Query parameters

  • limit (optional): Page size (1–100, default 100).
  • after (optional): Keyset cursor — return the page after this row (next page).
  • before (optional): Keyset cursor — return the page before this row (prev page).
  • ids (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
  • filter (optional): Nested filter expression (<Entity>Filter): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
  • orderBy (optional): Multi-key sort (<Entity>OrderBy[]): array of { field: direction } applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
  • workspace_id (optional): Filter to runs in this workspace. When omitted, returns runs across every workspace the caller is a member of (admins see all).
  • agent_id (optional): Filter to runs of a specific agent.
  • swarm_id (optional): Filter to runs of a specific swarm.
  • function_id (optional): Filter to runs of a specific function.
  • subject_id (optional): Filter to runs of the given subject entity.
  • status (optional): Filter by run status.
  • subject_type (optional): Filter by subject entity type.
  • parent_id (optional): Filter to runs spawned from this parent run.
  • parent_run_id (optional): Shorthand: filter where parentRunId equals this value.
  • mode (optional): Shorthand: filter where mode equals this value.
  • triggered_by (optional): Shorthand: filter where triggeredBy equals this value.
  • user_id (optional): Shorthand: filter where userId equals this value.

Response

JSON
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "subjectId": "<...>",
      "parentRunId": "<...>",
      "status": "<...>",
      "mode": "<...>",
      "input?": "<...>",
      "output?": "<...>",
      "error": "<...>",
      "triggeredBy": "<...>",
      "cfWorkflowId": "<...>",
      "durationMs": "<...>",
      "userId": "<...>",
      "startedAt": "<...>",
      "completedAt": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}

POST /api/runs

Create and execute a run

Unified endpoint to run any entity (agent, function, swarm, workflow). The entity type is detected from the ID prefix.

Request body

JSON
{
  "id": "any",
  "input": {},
  "mode?": "sync | async"
}

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

GET /api/runs/{id}

Get a run by ID.

Path parameters

  • id (required): Run to retrieve.

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

POST /api/runs/{id}/cancel

Cancel a pending or running run

Path parameters

  • id (required): The run's prefixed ID (e.g. run_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

POST /api/runs/{id}/pause

Pause a running workflow run

Workflow runs only. Other run types return 400.

Path parameters

  • id (required): The run's prefixed ID (e.g. run_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

POST /api/runs/{id}/resume

Resume a paused workflow run

Workflow runs only. Other run types return 400.

Path parameters

  • id (required): The run's prefixed ID (e.g. run_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

POST /api/runs/{id}/retry

Retry a failed workflow run

Workflow runs only. Other run types return 400.

Path parameters

  • id (required): The run's prefixed ID (e.g. run_...).

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "subjectId": "any",
  "parentRunId": "string",
  "status": "pending | running | completed | failed",
  "mode": "sync | async",
  "input?": "any",
  "output?": "any",
  "error": "string",
  "triggeredBy": "user | agent | swarm | workflow",
  "cfWorkflowId": "string",
  "durationMs": "number",
  "userId": "string",
  "startedAt": "string",
  "completedAt": "string",
  "createdAt": "string",
  "updatedAt": "string"
}