{
  "openapi": "3.0.1",
  "info": {
    "title": "SEC Insider Trades Monitor (EDGAR Form 4)",
    "description": "SEC insider-trading monitor on EDGAR: Form 4 (and 3/5) filings for a ticker watchlist over a lookback window — insider name and role, 10b5-1 flag, transaction codes, shares and dollar values. Optional Telegram alert on insider buys over a threshold. Official SEC data, no key needed.",
    "version": "0.1",
    "x-build-id": "UK11L1ZJOyWId0tcf"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automatic~sec-insider-trades/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automatic-sec-insider-trades",
        "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/automatic~sec-insider-trades/runs": {
      "post": {
        "operationId": "runs-sync-automatic-sec-insider-trades",
        "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/automatic~sec-insider-trades/run-sync": {
      "post": {
        "operationId": "run-sync-automatic-sec-insider-trades",
        "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": {
          "tickers": {
            "title": "Watchlist",
            "maxItems": 50,
            "type": "array",
            "description": "Ticker watchlist (case-insensitive; 'aapl' and 'AAPL' are the same), up to 50. Defaults to ten heavily traded large caps; an empty list runs that default watchlist.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": [
              "AAPL",
              "MSFT",
              "NVDA",
              "AMZN",
              "GOOGL",
              "META",
              "TSLA",
              "JPM",
              "WMT",
              "ORCL"
            ]
          },
          "lookbackDays": {
            "title": "Lookback window (days)",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "How many calendar days back (inclusive of today) the filingDate window reaches. Default 30, which spans quiet earnings-blackout weeks; 1–7 suits a daily or weekly schedule.",
            "default": 30
          },
          "forms": {
            "title": "Form filter",
            "minItems": 1,
            "uniqueItems": true,
            "type": "array",
            "description": "Which SEC ownership forms to collect. Default ['4'] (current insider transactions); 3 = initial statement, 5 = annual, /A = amendments.",
            "items": {
              "type": "string",
              "enum": [
                "3",
                "3/A",
                "4",
                "4/A",
                "5",
                "5/A"
              ]
            },
            "default": [
              "4"
            ]
          },
          "maxFilings": {
            "title": "Max filings per run",
            "minimum": 10,
            "maximum": 500,
            "type": "integer",
            "description": "Upper bound on collected filings per run (newest first). Each filing costs one Form 4 document request for the insider/transaction detail.",
            "default": 100
          },
          "alertMinUsd": {
            "title": "Alert threshold (insider buy USD)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "number",
            "description": "When > 0, every parsed insider BUY whose non-derivative dollar value (shares × price, acquired side) is at or above this amount sends one inline Telegram alert ('AAPL insider buy: Name (role) — N sh ≈ $X (Form 4 filed date)'). 0 (the default) disables alerts entirely.",
            "default": 0
          },
          "telegramBotToken": {
            "title": "Telegram bot token (secret)",
            "type": "string",
            "description": "Bot token for the insider-buy alerts — a secret: never share runs or datasets that expose it. Falls back to the TELEGRAM_BOT_TOKEN secret environment variable when empty. Never printed; masked in any warning line."
          },
          "telegramChatId": {
            "title": "Telegram chat id",
            "type": "string",
            "description": "Telegram chat id for the insider-buy alerts. With telegramBotToken (or TELEGRAM_BOT_TOKEN) and alertMinUsd > 0, each qualifying buy sends one inline message. A failed or skipped send is a warning, never a failed run."
          },
          "requestDelaySecs": {
            "title": "Delay between EDGAR requests",
            "minimum": 0,
            "maximum": 10,
            "type": "number",
            "description": "Minimum spacing between EDGAR requests, retries included (SEC fair-access guideline: max 10 requests/second). Default 0.2 s; values below 0.125 s are raised to 0.125 s so a run never exceeds 8 requests/second.",
            "default": 0.2
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}