{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-run-list-schema.json",
  "title": "RunList",
  "description": "`{data, count, total}` list envelope (runs only).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usewrit-app-runs-api-openapi.yml#/components/schemas/RunList",
  "type": "object",
  "required": [
    "data",
    "count",
    "total"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RunFeedItem"
      }
    },
    "count": {
      "type": "integer",
      "description": "Number of items in this page."
    },
    "total": {
      "type": "integer",
      "description": "Post-filter total before pagination."
    }
  },
  "$defs": {
    "RunFeedItem": {
      "type": "object",
      "description": "Enriched run-feed projection (`api/v1/runs.rs::RunFeedItem`). `id` is a COMPOSITE STRING `\"<run_type>-<row_id>\"` (e.g. `\"workflow-3\"`); the numeric id for get/cancel/events is the part after the last dash.",
      "required": [
        "id",
        "run_type",
        "entity_id",
        "entity_name",
        "status",
        "started_at",
        "finished_at",
        "duration_ms",
        "trigger_source",
        "error",
        "detail_url_hint",
        "data_url_hint",
        "rows_extracted",
        "change_detected"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Composite feed id: `\"<run_type>-<row_id>\"`."
        },
        "run_type": {
          "type": "string",
          "enum": [
            "workflow",
            "check",
            "automation"
          ]
        },
        "entity_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "The associated workflow / target / automation id, per `run_type`."
        },
        "entity_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Resolved entity name (workflow runs; `Run <id>` fallback)."
        },
        "status": {
          "type": "string",
          "description": "Open string enum. Known values: `running`, `success`, `failed`, `cancelled`, `timeout`, `captcha_required`, `twofa_required`, `interrupted`."
        },
        "started_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "RFC3339; falls back to the row's created time."
        },
        "finished_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "duration_ms": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "trigger_source": {
          "type": [
            "string",
            "null"
          ],
          "description": "The run's trigger type (`manual`, `schedule`, …)."
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "The failure message for failed runs."
        },
        "detail_url_hint": {
          "type": [
            "string",
            "null"
          ],
          "description": "Frontend deep-link to the owning entity (e.g. `/workflows/3`)."
        },
        "data_url_hint": {
          "type": [
            "string",
            "null"
          ],
          "description": "Deep-link to the Data view — present only for successful, row-producing, non-streaming workflow runs."
        },
        "rows_extracted": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Workflow runs only — extracted record count; null for other types."
        },
        "change_detected": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Check runs only — whether the check detected a change; null otherwise."
        },
        "engine": {
          "type": "string",
          "description": "Which lane ran this (`http` | `browser` | `hybrid`), from the result payload. OMITTED (not null) for non-workflow runs and older results."
        }
      }
    }
  }
}