{
  "openapi": "3.0.1",
  "info": {
    "title": "USGS Gauge Threshold Crossing Feed",
    "description": "Turn fresh USGS Water Data API v1 gauge readings into bounded, machine-readable site checks and threshold transitions from a prior Actor dataset. Explicit units, local gage datum, provisional status and freshness; no flood or safety verdict.",
    "version": "0.1",
    "x-build-id": "pEtj2TWfXtvYGzYIs"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/natstandridge~usgs-gauge-threshold-crossing-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-natstandridge-usgs-gauge-threshold-crossing-feed",
        "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/natstandridge~usgs-gauge-threshold-crossing-feed/runs": {
      "post": {
        "operationId": "runs-sync-natstandridge-usgs-gauge-threshold-crossing-feed",
        "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/natstandridge~usgs-gauge-threshold-crossing-feed/run-sync": {
      "post": {
        "operationId": "run-sync-natstandridge-usgs-gauge-threshold-crossing-feed",
        "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": {
          "sites": {
            "title": "USGS sites and thresholds",
            "maxItems": 50,
            "type": "array",
            "description": "At most 50 site/parameter pairs. Use an exact USGS numeric site ID, parameter 00060 streamflow (ft^3/s) or 00065 gage height (ft), direction above/below, and a threshold in that unit. No URLs are accepted. An explicit empty list makes no request.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "parameterCode",
                "unit",
                "direction",
                "threshold"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[0-9]{7,15}$",
                  "title": "USGS site ID",
                  "description": "Exact 7–15 digit USGS site number; no URL, hostname, or site-name lookup.",
                  "editor": "textfield"
                },
                "parameterCode": {
                  "enum": [
                    "00060",
                    "00065"
                  ],
                  "title": "Water parameter code",
                  "description": "00060 is instantaneous streamflow; 00065 is gage height.",
                  "editor": "select",
                  "type": "string"
                },
                "unit": {
                  "enum": [
                    "ft^3/s",
                    "ft3/s",
                    "ft"
                  ],
                  "title": "Threshold unit",
                  "description": "Use ft^3/s (or ft3/s) for 00060, or ft for 00065. The Actor checks the source unit.",
                  "editor": "select",
                  "type": "string"
                },
                "direction": {
                  "enum": [
                    "above",
                    "below"
                  ],
                  "title": "Threshold direction",
                  "description": "Choose above or below; equal values are at the threshold.",
                  "editor": "select",
                  "type": "string"
                },
                "threshold": {
                  "type": "number",
                  "title": "Threshold value",
                  "description": "Finite numeric threshold in the selected unit and local gage datum where applicable.",
                  "editor": "number"
                }
              }
            },
            "default": [
              {
                "id": "01646500",
                "parameterCode": "00060",
                "unit": "ft^3/s",
                "direction": "above",
                "threshold": 10000
              }
            ]
          },
          "monitorKey": {
            "title": "Watchlist label",
            "minLength": 1,
            "maxLength": 40,
            "type": "string",
            "description": "Stable label for this watchlist; use the same value with previousResultsJson. Letters, digits, underscores and hyphens only.",
            "default": "default"
          },
          "previousResultsJson": {
            "title": "Previous Actor dataset JSON (optional)",
            "maxLength": 524288,
            "type": "string",
            "description": "Paste this Actor’s earlier default dataset JSON array to compare fresh observations with the last check. No account-wide history is read automatically. Up to 50 rows and 512 KiB."
          },
          "maxAgeMinutes": {
            "title": "Maximum reading age in minutes",
            "minimum": 15,
            "maximum": 1440,
            "type": "integer",
            "description": "Readings older than this are listed as uncharged diagnostics, not crossing rows.",
            "default": 120
          },
          "lookbackHours": {
            "title": "Maximum previous-check lookback in hours",
            "minimum": 1,
            "maximum": 168,
            "type": "integer",
            "description": "A previous Actor result older than this cannot trigger a crossing. Only the latest current USGS reading is fetched.",
            "default": 24
          },
          "maxRunSeconds": {
            "title": "Maximum processing time in seconds",
            "minimum": 30,
            "maximum": 240,
            "type": "integer",
            "description": "Bounded source requests and delivery; unfinished sites become uncharged diagnostics.",
            "default": 180
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}