{
  "openapi": "3.0.1",
  "info": {
    "title": "Workflow Heartbeat Monitor - n8n, Make & Cron",
    "description": "Detect workflows that never finish. Add one heartbeat at the final successful step, then audit n8n, Make, cron and Apify schedules for silence, failed completions and zero useful output.",
    "version": "0.1",
    "x-build-id": "NojhEIqLtxg9Il2vb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automa-flow~workflow-heartbeat-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automa-flow-workflow-heartbeat-monitor",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/automa-flow~workflow-heartbeat-monitor/runs": {
      "post": {
        "operationId": "runs-sync-automa-flow-workflow-heartbeat-monitor",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/automa-flow~workflow-heartbeat-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-automa-flow-workflow-heartbeat-monitor",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "checkin",
              "audit"
            ],
            "type": "string",
            "description": "checkin stores one heartbeat. audit reads saved heartbeats and does not update them. If you leave mode out, an input with monitors is an audit and any other input is a check-in. The demo run is a check-in."
          },
          "monitorKey": {
            "title": "Monitor key",
            "pattern": "^(?=.*[A-Za-z0-9_./-])[A-Za-z0-9 _./-]{1,100}$",
            "minLength": 1,
            "maxLength": 100,
            "type": "string",
            "description": "Stable name for one workflow, used by check-in. 1-100 characters: letters, numbers, spaces, '_', '-', '.' or '/'. Trimmed. Ignored in audit mode, where each monitor has its own key. Required for check-in; there is no default, so a forgotten key never lands on the demo key. The form prefills the demo key."
          },
          "ok": {
            "title": "Final step succeeded",
            "type": "boolean",
            "description": "Required for check-in. True only when the workflow finished the useful work. False records a failed completion. Omitting ok does not count as success. The form prefills true for the demo. Ignored in audit mode."
          },
          "count": {
            "title": "Useful output count",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "integer",
            "description": "Optional count of useful records the workflow produced. Omit it when you do not know. An audit with minCount treats a missing count as invalid state, not as zero. Ignored in audit mode."
          },
          "durationMs": {
            "title": "Duration (ms)",
            "minimum": 0,
            "maximum": 6048000000,
            "type": "integer",
            "description": "Optional workflow duration in milliseconds, from 0 to 70 days. Ignored in audit mode."
          },
          "message": {
            "title": "Short note",
            "pattern": "^[^\\x00-\\x1F\\x7F]{0,500}$",
            "maxLength": 500,
            "type": "string",
            "description": "Optional note of at most 500 characters, stored on the heartbeat only. No control characters. Do not put secrets, tokens, customer payloads or personal data here. It is not copied into audit rows. Ignored in audit mode."
          },
          "monitors": {
            "title": "Monitors to audit",
            "minItems": 1,
            "maxItems": 500,
            "uniqueItems": true,
            "type": "array",
            "description": "Required for audit: 1 to 500 workflow definitions. Omit this on check-in. Identical monitor objects are rejected here. The same monitorKey with different settings is rejected when the run starts. With monitors and no mode, the run is an audit. An explicit checkin that includes monitors is rejected so an audit is not silently skipped.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "monitorKey",
                "maxSilenceMinutes"
              ],
              "properties": {
                "monitorKey": {
                  "title": "Monitor key",
                  "type": "string",
                  "description": "Same key the workflow sends at check-in.",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^(?=.*[A-Za-z0-9_./-])[A-Za-z0-9 _./-]{1,100}$"
                },
                "maxSilenceMinutes": {
                  "title": "Max silence (minutes)",
                  "type": "integer",
                  "description": "How long the last successful check-in may be before the workflow is LATE. 1 to 100800 (70 days). The audit schedule should run more often than this window.",
                  "minimum": 1,
                  "maximum": 100800
                },
                "minCount": {
                  "title": "Minimum useful count",
                  "type": "integer",
                  "description": "Optional. If set, a stored count below it is unhealthy. minCount 1 and count 0 is ZERO_OUTPUT. A missing stored count is INVALID_STATE.",
                  "minimum": 0,
                  "maximum": 1000000000
                },
                "requireOk": {
                  "title": "Require a successful check-in",
                  "type": "boolean",
                  "description": "When true (the default), lastOk false is FAILED and is not reclassified as late.",
                  "default": true
                }
              }
            }
          },
          "asOf": {
            "title": "Evaluate as of",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "type": "string",
            "description": "Audit only. Optional ISO-8601 timestamp with a timezone. It sets the clock for the age comparison against the current heartbeat. It does not reconstruct history and cannot be more than 5 minutes in the future. Check-in rejects this field."
          },
          "problemsOnly": {
            "title": "Write rows only for workflows that need attention",
            "type": "boolean",
            "description": "Audit only. When on, HEALTHY workflows are left out of the Dataset, so every row is a problem and the run's result count is the number of workflows that need attention. That is what the Monitoring alert watches. They are still evaluated and billed. Default off, so you see every workflow on a first try. Ignored on check-in.",
            "default": false
          },
          "failRunOnProblem": {
            "title": "Fail the run when a workflow is unhealthy (optional)",
            "type": "boolean",
            "description": "Audit only. Default off: an audit that finds problems still succeeds and lists them. Turn on only if you prefer a failed run as the alert, for example with a failed-run notification or webhook. Rows and the run summary are saved first. Ignored on check-in.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}