{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Insights Scraper",
    "description": "Scrape Substack publications, posts (HTML + markdown for AI/RAG), comments, Notes feeds, author profiles and contact info from bios. Input-time filters (paywall, reactions, words, keywords, subscribers). Historical subscriber-growth tracking across scheduled runs.",
    "version": "1.0",
    "x-build-id": "gOEvW94Ne9ph6fmYI"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/brilliant_gum~substack-insights-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-brilliant_gum-substack-insights-scraper",
        "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/brilliant_gum~substack-insights-scraper/runs": {
      "post": {
        "operationId": "runs-sync-brilliant_gum-substack-insights-scraper",
        "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/brilliant_gum~substack-insights-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-brilliant_gum-substack-insights-scraper",
        "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": {
          "urls": {
            "title": "Substack URLs",
            "type": "array",
            "description": "Publication or post URLs (e.g. https://example.substack.com or https://example.substack.com/p/some-post). Bare handles and @usernames also accepted. Leave empty if you use 'Publication handles', 'User handles' or 'Search queries' instead.",
            "items": {
              "type": "string"
            }
          },
          "publicationHandles": {
            "title": "Publication handles",
            "type": "array",
            "description": "Bare publication handles (e.g. 'noahpinion'). Convenient for CSV lists.",
            "items": {
              "type": "string"
            }
          },
          "userHandles": {
            "title": "User handles (for author profile + Notes)",
            "type": "array",
            "description": "User handles to fetch author profile and Notes feed.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search queries (publication discovery)",
            "type": "array",
            "description": "Keywords to search Substack's global publication directory.",
            "items": {
              "type": "string"
            }
          },
          "maxSearchResults": {
            "title": "Max results per search query",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many top publications to return per search query.",
            "default": 10
          },
          "includePosts": {
            "title": "Include posts",
            "type": "boolean",
            "description": "For each publication, fetch the post archive.",
            "default": true
          },
          "maxPostsPerPublication": {
            "title": "Max posts per publication",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on posts fetched per publication.",
            "default": 25
          },
          "includeFullBody": {
            "title": "Include full post body",
            "type": "boolean",
            "description": "Fetch the full body of each post (extra request per post). Disable to skip and rely on archive snippets only.",
            "default": true
          },
          "bodyFormat": {
            "title": "Body format",
            "enum": [
              "both",
              "html",
              "markdown",
              "none"
            ],
            "type": "string",
            "description": "Which body format(s) to keep. 'markdown' is the AI/RAG-friendly form.",
            "default": "both"
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Fetch nested comments per post (extra request per post that has comments).",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Cap on comments fetched per post.",
            "default": 100
          },
          "includeNotes": {
            "title": "Include Notes feed (per user handle)",
            "type": "boolean",
            "description": "For each user handle, pull their Notes/restacks feed.",
            "default": false
          },
          "maxNotesPerAuthor": {
            "title": "Max notes per author",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on notes/restacks fetched per author handle.",
            "default": 50
          },
          "paywallFilter": {
            "title": "Paywall filter",
            "enum": [
              "any",
              "free-only",
              "paid-only"
            ],
            "type": "string",
            "description": "Keep all posts, only free ones, or only paid ones.",
            "default": "any"
          },
          "minReactions": {
            "title": "Min reactions per post (filter applied before billing — no charge for filtered entities)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip posts below this reaction count.",
            "default": 0
          },
          "minComments": {
            "title": "Min comments per post",
            "minimum": 0,
            "type": "integer",
            "description": "Skip posts below this comment count.",
            "default": 0
          },
          "minRestacks": {
            "title": "Min restacks per post",
            "minimum": 0,
            "type": "integer",
            "description": "Skip posts below this restack count.",
            "default": 0
          },
          "minWordCount": {
            "title": "Min word count per post",
            "minimum": 0,
            "type": "integer",
            "description": "Useful for AI/RAG to filter out short announcements.",
            "default": 0
          },
          "maxWordCount": {
            "title": "Max word count per post (0 = unlimited)",
            "minimum": 0,
            "type": "integer",
            "description": "Drop posts longer than this. 0 means no upper limit.",
            "default": 0
          },
          "dateFrom": {
            "title": "Earliest post date",
            "type": "string",
            "description": "ISO date or YYYY-MM-DD. Drop posts older than this."
          },
          "dateTo": {
            "title": "Latest post date",
            "type": "string",
            "description": "ISO date or YYYY-MM-DD. Drop posts newer than this."
          },
          "keywordsInclude": {
            "title": "Must contain keywords",
            "type": "array",
            "description": "Drop posts whose title + subtitle + body text doesn't include at least one of these (case-insensitive).",
            "items": {
              "type": "string"
            }
          },
          "keywordsExclude": {
            "title": "Must NOT contain keywords",
            "type": "array",
            "description": "Drop posts whose text contains any of these keywords.",
            "items": {
              "type": "string"
            }
          },
          "hasPodcast": {
            "title": "Has podcast filter",
            "enum": [
              "any",
              "yes",
              "no"
            ],
            "type": "string",
            "description": "Keep only posts with (or without) an attached podcast.",
            "default": "any"
          },
          "postType": {
            "title": "Post type allow-list",
            "type": "array",
            "description": "Keep only certain post types (newsletter, podcast, thread). Empty = all.",
            "items": {
              "type": "string"
            }
          },
          "minSubscribers": {
            "title": "Min subscribers per publication",
            "minimum": 0,
            "type": "integer",
            "description": "Skip publications below this subscriber count. Note: ~50% of publications hide subscriber counts — those are also skipped when this filter is on.",
            "default": 0
          },
          "paymentsEnabledOnly": {
            "title": "Payments-enabled publications only",
            "type": "boolean",
            "description": "Skip publications that don't offer paid subscriptions.",
            "default": false
          },
          "includeContactInfo": {
            "title": "Extract contact info (lead-gen)",
            "type": "boolean",
            "description": "Parse emails, phones, payment links and categorise social/website links from bios.",
            "default": true
          },
          "includeAnalytics": {
            "title": "Compute analytics block",
            "type": "boolean",
            "description": "Per-publication engagement rate, virality index, publish cadence, paid-post ratio, momentum (when history is on).",
            "default": true
          },
          "outputMarkdownFiles": {
            "title": "Export per-post .md files (AI/RAG mode)",
            "type": "boolean",
            "description": "Write each post body as a separate .md file to the 'substack-markdown' key-value store, with YAML front matter. Useful for LlamaIndex/LangChain ingestion.",
            "default": false
          },
          "enableHistory": {
            "title": "Enable historical tracking (subscriber growth & post velocity)",
            "type": "boolean",
            "description": "Persist a timestamped snapshot every run into a named store, then compute deltas (subscriber growth per day, posts added, trend) vs the previous run. Schedule the actor daily/weekly to build a time-series.",
            "default": false
          },
          "historyDatasetName": {
            "title": "History store name",
            "type": "string",
            "description": "Named key-value store to persist snapshots into. Reused across scheduled runs.",
            "default": "substack-history"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Proxies are included and configured automatically — leave empty unless overriding."
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Parallel workers.",
            "default": 5
          },
          "minDelayMs": {
            "title": "Min delay between requests (ms)",
            "minimum": 200,
            "maximum": 10000,
            "type": "integer",
            "description": "Per-request throttle.",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}