{
  "openapi": "3.0.1",
  "info": {
    "title": "Scheduled Job Heartbeat and Silence Ledger",
    "description": "Your cron job sends one curl ping after each run. This Actor keeps the ledger in a named key-value store and reports every job that went silent, with an optional webhook alert. HTTP only, no browser, no proxy, no database.",
    "version": "0.1",
    "x-build-id": "bKcWeGwv4rn1PMb7z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kingii98~scheduled-job-heartbeat-and-silence-ledger/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kingii98-scheduled-job-heartbeat-and-silence-ledger",
        "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/kingii98~scheduled-job-heartbeat-and-silence-ledger/runs": {
      "post": {
        "operationId": "runs-sync-kingii98-scheduled-job-heartbeat-and-silence-ledger",
        "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/kingii98~scheduled-job-heartbeat-and-silence-ledger/run-sync": {
      "post": {
        "operationId": "run-sync-kingii98-scheduled-job-heartbeat-and-silence-ledger",
        "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",
        "required": [
          "jobs",
          "mode",
          "ledgerStoreName"
        ],
        "properties": {
          "jobs": {
            "title": "Monitored jobs",
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "description": "1 to 50 records. Each record holds slug (the identifier in the ping URL, for example \"nightly-backup\"), name (the human name of the job), expected_max_gap_minutes (the longest silence that is still normal between two runs) and the optional grace_minutes (the extra time before a late job counts as missed).",
            "default": [
              {
                "slug": "nightly-backup",
                "name": "Nightly database backup",
                "expected_max_gap_minutes": 1440,
                "grace_minutes": 30
              },
              {
                "slug": "hourly-etl",
                "name": "Hourly ETL step",
                "expected_max_gap_minutes": 60,
                "grace_minutes": 10
              },
              {
                "slug": "queue-worker",
                "name": "Queue worker heartbeat",
                "expected_max_gap_minutes": 15,
                "grace_minutes": 5
              }
            ]
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "evaluate",
              "receive"
            ],
            "type": "string",
            "description": "\"evaluate\" reads the ledger and reports the silent jobs. Run it on the Apify scheduler every 15 minutes. \"receive\" starts the HTTP server that accepts the pings. A run in Apify Standby always uses the receive mode, whatever this field holds.",
            "default": "evaluate"
          },
          "ledgerStoreName": {
            "title": "Ledger key-value store name",
            "type": "string",
            "description": "The named Apify key-value store that holds one record for each slug: last ping time, last status and the count of consecutive misses. The receive mode and the evaluate mode must use the same name.",
            "default": "heartbeat-ledger"
          },
          "pingSecret": {
            "title": "Ping secret",
            "type": "string",
            "description": "Optional shared secret. The ping caller sends it as the query value \"?secret=\" or as the header \"X-Ping-Secret\". An empty value accepts every ping."
          },
          "alertWebhookUrl": {
            "title": "Alert webhook URL",
            "type": "string",
            "description": "Optional. One public HTTPS URL. The Actor sends one JSON POST for each job that becomes late or missed. Loopback, private and reserved addresses are refused. Leave it empty to read the alerts in the dataset only.",
            "default": ""
          },
          "defaultGraceMinutes": {
            "title": "Default grace minutes",
            "minimum": 0,
            "maximum": 1440,
            "type": "integer",
            "description": "The grace value for a job record that holds no grace_minutes. A job is \"late\" after the expected gap and \"missed\" after the expected gap plus the grace.",
            "default": 5
          },
          "suppressRepeatAlerts": {
            "title": "Suppress repeated alerts",
            "type": "boolean",
            "description": "Send one alert when the status of a job changes, and not on every schedule tick. Switch it off to receive one alert for each evaluate run while the job stays silent.",
            "default": true
          },
          "timeoutSeconds": {
            "title": "Webhook timeout (seconds)",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Timeout for one alert POST to your webhook.",
            "default": 15
          },
          "receiveMaxSeconds": {
            "title": "Receive mode time limit (seconds)",
            "minimum": 5,
            "maximum": 3600,
            "type": "integer",
            "description": "How long a manual receive run stays open. A run in Apify Standby ignores this limit, because the platform controls the life of a Standby container.",
            "default": 60
          },
          "maxRequestBytes": {
            "title": "Maximum ping request bytes",
            "minimum": 1024,
            "maximum": 262144,
            "type": "integer",
            "description": "Hard cap on the bytes that the receive mode reads from one ping request. A larger request is refused with HTTP 413.",
            "default": 16384
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}