{
  "openapi": "3.0.1",
  "info": {
    "title": "Apify Run Health Monitor",
    "description": "Check your own Apify actors for failed, timed out, slow, and empty runs, on your own Apify API token. One health row per actor with run counts, failure rate, durations, empty dataset checks, and usage, plus a free alert row for each problem run.",
    "version": "0.1",
    "x-build-id": "8OKOwDUs7C52Xuz9m"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mambalabs~apify-run-health-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mambalabs-apify-run-health-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/mambalabs~apify-run-health-monitor/runs": {
      "post": {
        "operationId": "runs-sync-mambalabs-apify-run-health-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/mambalabs~apify-run-health-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-mambalabs-apify-run-health-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": {
          "actors": {
            "title": "Actors to check",
            "type": "array",
            "description": "Actor IDs, username/name, or Apify Console or Store URLs, one per line. Use the single word all to check every actor that started a run in the window. Store actors you run count too: their runs on your account are read.",
            "items": {
              "type": "string"
            }
          },
          "api_token": {
            "title": "Apify API token",
            "type": "string",
            "description": "Your own Apify API token, from Apify Console, Settings, API and Integrations. It is sent only to api.apify.com and is never stored, logged, or written to a row. A scoped token needs read access to actors, runs, and datasets. With no token, the run writes one free row and reads nothing."
          },
          "lookback_hours": {
            "title": "Window (hours)",
            "type": "string",
            "description": "How far back to read runs, 1 to 2160 hours (default 24). Runs started in this window are counted.",
            "default": "24"
          },
          "max_failure_pct": {
            "title": "Failure rate limit (%)",
            "type": "string",
            "description": "An actor whose failed plus timed out runs pass this share of its finished runs is marked unhealthy, 0 to 100 (default 10).",
            "default": "10"
          },
          "min_items": {
            "title": "Minimum items per run",
            "type": "string",
            "description": "A succeeded run whose dataset holds fewer items than this counts as empty (default 1). Set 0 to skip the dataset check.",
            "default": "1"
          },
          "datasets_per_actor": {
            "title": "Datasets to check per actor",
            "type": "string",
            "description": "How many of each actor's newest succeeded runs get their dataset item count read, 0 to 20 (default 3).",
            "default": "3"
          },
          "slow_factor": {
            "title": "Slow run factor",
            "type": "string",
            "description": "A succeeded run that takes more than this many times the actor's median run time, and at least 30 s longer, counts as slow, 1.2 to 100 (default 2). Needs 3 or more succeeded runs in the window.",
            "default": "2"
          },
          "count_aborted_as_failed": {
            "title": "Count aborted runs as failed",
            "type": "string",
            "description": "yes or no (default no). Aborted runs are often stopped by hand, so by default they lower the verdict to warning but do not count in the failure rate.",
            "default": "no"
          },
          "alert_rows": {
            "title": "Alert rows",
            "type": "string",
            "description": "yes or no (default yes). Writes a free row for each problem run, newest first, up to 20 per actor.",
            "default": "yes"
          },
          "include_idle_actors": {
            "title": "Include actors with no runs",
            "type": "string",
            "description": "yes or no (default no). With actors set to all, also checks every actor your account owns that started no run in the window; each gets the verdict no_runs and is charged like any other actor checked.",
            "default": "no"
          },
          "max_actors": {
            "title": "Maximum actors",
            "type": "string",
            "description": "Most actors to check in one run, 1 to 1000 (default 100). With all, the actors with the most runs come first.",
            "default": "100"
          },
          "max_runs": {
            "title": "Maximum runs to read",
            "type": "string",
            "description": "Most runs to read from your run list, newest first, 100 to 50000 (default 10000). Each health row says when this limit cut the window short.",
            "default": "10000"
          },
          "max_charge_usd": {
            "title": "Maximum charge for this run (USD)",
            "type": "string",
            "description": "Optional. The run stops before a charge that would pass this amount. Rows already written stay, and one free row names the first actor not checked."
          },
          "source_tag": {
            "title": "Source tag",
            "type": "string",
            "description": "Internal attribution tag. Leave empty."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}