{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper (Posts & Newsletters)",
    "description": "Substack Scraper SD - Substack Scraper is a newsletter data tool that extracts Substack posts by newsletter URL, post URL or keyword: full text and HTML, date, reactions, comments with replies, author, subscriber count and Notes. No login.",
    "version": "1.0",
    "x-build-id": "aAa7PrWilCCwd5IXK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/neuro-scraper~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-neuro-scraper-substack-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/neuro-scraper~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-neuro-scraper-substack-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/neuro-scraper~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-neuro-scraper-substack-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": "Newsletter or post URLs",
            "type": "array",
            "description": "Substack newsletters or posts, one per line: a newsletter home page (https://simonw.substack.com), a custom domain (https://www.lennysnewsletter.com), an /archive URL, a post URL (https://simonw.substack.com/p/<slug>, https://open.substack.com/pub/<name>/p/<slug>), an author profile (https://substack.com/@simonw = the author's main newsletter) or just the subdomain (simonw).",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Search keywords (optional)",
            "type": "array",
            "description": "Topics to search across all of Substack, one per line, e.g. \"climate policy\", \"artificial intelligence\". What is collected depends on Keyword mode below.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywordMode": {
            "title": "Keyword mode",
            "enum": [
              "posts",
              "newsletters"
            ],
            "type": "string",
            "description": "posts = the posts Substack's own search returns for each keyword (across all newsletters); newsletters = Substack's newsletter search for each keyword, then up to 'Max posts per newsletter' from each newsletter found.",
            "default": "posts"
          },
          "maxSearchResultsPerKeyword": {
            "title": "Max results per keyword",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Posts (mode posts) or newsletters (mode newsletters) to take per keyword. The scraper follows Substack's search pages (cursor) until this number or the end of the results.",
            "default": 20
          },
          "searchKeyword": {
            "title": "Search inside the newsletters (optional)",
            "type": "string",
            "description": "Only posts of the given newsletters that match this word or phrase, e.g. \"sqlite\" - Substack's own archive search (applied by Substack on the server).",
            "default": ""
          },
          "sortBy": {
            "title": "Archive order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Order in which a newsletter's archive is read - Substack's own archive sort.",
            "default": "new"
          },
          "maxPostsPerNewsletter": {
            "title": "Max posts per newsletter",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop each newsletter after this many posts. The scraper pages through the newsletter's archive (12 posts per page) until this number or the first post. 0 = the whole archive.",
            "default": 20
          },
          "maxItems": {
            "title": "Max results (whole run)",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Stop the run after this many rows in total (posts + Notes from every input). 0 = no total limit.",
            "default": 100
          },
          "includeContent": {
            "title": "Include full post content",
            "type": "boolean",
            "description": "Open every post for its full body (HTML and/or text), last-update date and next/previous post. One extra request per post. Paid posts give the free preview part only (Substack's paywall). Off = metadata only (faster).",
            "default": true
          },
          "contentFormat": {
            "title": "Content format",
            "enum": [
              "both",
              "html",
              "text"
            ],
            "type": "string",
            "description": "Which body columns to fill when 'Include full post content' is on: bodyHtml, bodyText or both.",
            "default": "both"
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Add each post's public comments with their nested replies (author name, handle, date, text, reactions) in the comments column. One extra request per post that has comments.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Comments per post including replies, best first (Substack sends the whole thread in one answer; the list is cut here). 0 = all.",
            "default": 20
          },
          "includePublicationInfo": {
            "title": "Include newsletter info",
            "type": "boolean",
            "description": "Add the newsletter's name, description, logo, subscriber count, paid-plan status and the author's bio (one extra request per newsletter; keyword search results already carry it).",
            "default": true
          },
          "contentType": {
            "title": "Post type",
            "enum": [
              "all",
              "newsletter",
              "podcast",
              "thread",
              "video"
            ],
            "type": "string",
            "description": "Keep only this post type (the type field Substack gives each post; filtered by the scraper).",
            "default": "all"
          },
          "audienceFilter": {
            "title": "Free / paid",
            "enum": [
              "all",
              "free",
              "paid"
            ],
            "type": "string",
            "description": "Keep free posts (audience everyone) or paid posts only (filtered by the scraper on Substack's audience field).",
            "default": "all"
          },
          "dateFrom": {
            "title": "Published from",
            "type": "string",
            "description": "Only posts published on or after this date (YYYY-MM-DD). With 'Newest first' the archive stops at the first page older than this date.",
            "default": ""
          },
          "dateTo": {
            "title": "Published until",
            "type": "string",
            "description": "Only posts published on or before this date (YYYY-MM-DD).",
            "default": ""
          },
          "minReactions": {
            "title": "Min reactions",
            "minimum": 0,
            "type": "integer",
            "description": "Only posts with at least this many reactions (likes). 0 = off.",
            "default": 0
          },
          "minComments": {
            "title": "Min comments",
            "minimum": 0,
            "type": "integer",
            "description": "Only posts with at least this many comments. 0 = off.",
            "default": 0
          },
          "notesHandles": {
            "title": "Notes of these authors (optional)",
            "type": "array",
            "description": "Substack handles or profile URLs (simonw, @simonw, https://substack.com/@simonw) whose own public Notes to collect from their profile activity feed (one row per Note: text, date, reactions, restacks, replies count, attachments as image / link / post / quoted-Note entries). Other authors' Notes they restacked are skipped.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxNotesPerHandle": {
            "title": "Max Notes per author",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Notes per handle. The scraper follows the profile feed's cursor until this number or the end of the feed.",
            "default": 50
          },
          "minRestacks": {
            "title": "Min restacks",
            "minimum": 0,
            "type": "integer",
            "description": "Only posts restacked at least this many times. 0 = off.",
            "default": 0
          },
          "minWordCount": {
            "title": "Min word count",
            "minimum": 0,
            "type": "integer",
            "description": "Only posts with at least this many words (long-form only). 0 = off.",
            "default": 0
          },
          "hasPodcast": {
            "title": "Podcast episodes",
            "enum": [
              "any",
              "yes",
              "no"
            ],
            "type": "string",
            "description": "Keep only posts that carry an audio / podcast episode, or only those without.",
            "default": "any"
          },
          "language": {
            "title": "Post language",
            "type": "string",
            "description": "Two-letter language code (en, de, fr, es ...). Keeps only posts Substack marks with that language. Empty = all."
          },
          "minSubscribers": {
            "title": "Min newsletter subscribers",
            "minimum": 0,
            "type": "integer",
            "description": "Only posts of newsletters with at least this many subscribers (Substack's public subscriber count). 0 = off.",
            "default": 0
          },
          "paymentsEnabledOnly": {
            "title": "Only paid newsletters",
            "type": "boolean",
            "description": "Only posts of newsletters that have paid subscriptions turned on.",
            "default": false
          },
          "includeFacepile": {
            "title": "Who liked / restacked (facepile)",
            "type": "boolean",
            "description": "Adds a facepile column per post: the public profiles (name, handle, photo, their newsletter) of the people Substack shows as having liked and restacked the post. One extra request per post.",
            "default": false
          },
          "outputMarkdownFiles": {
            "title": "Save posts as Markdown files",
            "type": "boolean",
            "description": "Also saves every post as a .md file (title, subtitle, date, link, text) in the run's key-value store; the row gets markdownFileKey.",
            "default": false
          },
          "enableHistory": {
            "title": "Keep a history of post counters",
            "type": "boolean",
            "description": "Appends a snapshot of each post's likes, comments, restacks and word count to a named dataset that stays after the run, so scheduled runs build a time series.",
            "default": false
          },
          "historyDatasetName": {
            "title": "History dataset name",
            "type": "string",
            "description": "Name of the dataset that collects the history snapshots (letters, digits, dashes).",
            "default": "substack-history"
          },
          "maxConcurrency": {
            "title": "Newsletters in parallel",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many newsletter / post links are read at the same time, each with its own session.",
            "default": 3
          },
          "minDelayMs": {
            "title": "Pause between requests (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Minimum pause between two requests of one session, in milliseconds (a small random jitter is added).",
            "default": 800
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Substack answered every logged-out request without a challenge in tests; residential proxies are the default for steady runs on the Apify platform.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}