{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Posts, Newsletters & Comments",
    "description": "Scrape any Substack newsletter with no login: full text of free posts as text, Markdown or HTML, likes, comments, restacks, author and paid flag. Search all of Substack, list top newsletters by category with subscribers, prices and social links, and get only new posts.",
    "version": "0.1",
    "x-build-id": "zbhtNZBEGXy6QaDLJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mastertools~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mastertools-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/mastertools~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-mastertools-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/mastertools~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-mastertools-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": "Newsletters, posts or authors",
            "type": "array",
            "description": "One per line: a newsletter link (https://www.lennysnewsletter.com, https://name.substack.com), its Substack name (lenny), a post link (…/p/post-name) or an author profile (https://substack.com/@lenny). Custom domains work. Leave empty to search all of Substack or list categories.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Optional. With newsletter links above — posts of those newsletters that match. Without links — Substack-wide search: posts (or newsletters, see \"Search for\") from all of Substack. One search per line.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max results per newsletter or search",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "How many posts to take from each newsletter (and from each keyword), or how many newsletters from each search or category.",
            "default": 10
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Adds the readers' comments and replies of every post as their own rows: text, author, likes, date, thread.",
            "default": false
          },
          "textFormat": {
            "title": "Post text format",
            "enum": [
              "text",
              "markdown",
              "html",
              "none"
            ],
            "type": "string",
            "description": "Full text of free posts (paid posts up to the paywall): clean plain text, Markdown for AI and RAG, or the original HTML. \"No text\" is the fastest — titles, stats and links only.",
            "default": "text"
          },
          "sort": {
            "title": "Order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Newest posts first, or the newsletter's most popular posts of all time.",
            "default": "new"
          },
          "postAccess": {
            "title": "Free or paid posts",
            "enum": [
              "all",
              "free",
              "paid"
            ],
            "type": "string",
            "description": "All posts, only free ones (full text), or only paid ones (text up to the paywall).",
            "default": "all"
          },
          "postedAfter": {
            "title": "Posted after",
            "type": "string",
            "description": "Optional. Only posts newer than this: a date like 2026-01-01 or a period like 30 days."
          },
          "postedBefore": {
            "title": "Posted before",
            "type": "string",
            "description": "Optional. Only posts older than this date — the scraper jumps straight to it, so old periods are fast too."
          },
          "onlyNew": {
            "title": "Only new since the last run",
            "type": "boolean",
            "description": "For schedules and monitoring: each run returns only posts (or newsletters) that the previous runs with the same newsletters, keywords or categories have not returned yet.",
            "default": false
          },
          "categories": {
            "title": "Top newsletters by category",
            "type": "array",
            "description": "Optional. Substack's own category leaderboards — the leading newsletters with subscribers, prices, author, links and rank. Great for sponsorships, outreach and market maps.",
            "items": {
              "type": "string",
              "enum": [
                "technology",
                "business",
                "finance",
                "culture",
                "us-politics",
                "world-politics",
                "health-politics",
                "news",
                "science",
                "health",
                "education",
                "crypto",
                "food",
                "sports",
                "music",
                "art",
                "design",
                "fashion",
                "beauty",
                "travel",
                "parenting",
                "philosophy",
                "faith",
                "history",
                "literature",
                "fiction",
                "comics",
                "humor",
                "film-and-tv",
                "games",
                "climate",
                "international",
                "home-garden",
                "photography"
              ],
              "enumTitles": [
                "Technology",
                "Business",
                "Finance",
                "Culture",
                "U.S. Politics",
                "World Politics",
                "Health Politics",
                "News",
                "Science",
                "Health & Wellness",
                "Education",
                "Crypto",
                "Food & Drink",
                "Sports",
                "Music",
                "Art & Illustration",
                "Design",
                "Fashion",
                "Beauty",
                "Travel",
                "Parenting",
                "Philosophy",
                "Faith & Spirituality",
                "History",
                "Literature",
                "Fiction",
                "Comics",
                "Humor",
                "Film & TV",
                "Games",
                "Climate & Environment",
                "International",
                "Home & Garden",
                "Photography"
              ]
            }
          },
          "searchFor": {
            "title": "Search for",
            "enum": [
              "posts",
              "newsletters"
            ],
            "type": "string",
            "description": "What a Substack-wide keyword search returns: posts, or the newsletters that write about it (one row per newsletter with subscribers, prices and links).",
            "default": "posts"
          },
          "includeNewsletterDetails": {
            "title": "Add a newsletter row for each link",
            "type": "boolean",
            "description": "One extra row per newsletter from your links: subscribers, paid subscribers, prices, author, followers, leaderboard rank and social links.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "With comments on: how many comments and replies to take from each post, best first.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}