{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Newsletters, Posts, Full Text, Comments",
    "description": "Scrape Substack newsletters and posts from public JSON endpoints: author, public subscriber count, prices, social links, contact email, post likes, comments and full text of free posts. Find newsletters by keyword or category. No login. Paywalled text never returned.",
    "version": "1.0",
    "x-build-id": "tljXIIvtsft1uUzys"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zhtech~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zhtech-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/zhtech~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-zhtech-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/zhtech~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-zhtech-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": {
          "newsletters": {
            "title": "Newsletters",
            "type": "array",
            "description": "Newsletter URLs (https://name.substack.com or a custom domain like https://www.lennysnewsletter.com), bare subdomains (name), or author profiles (@handle, https://substack.com/@handle). Each one returns a newsletter profile row (author, description, public subscriber count, prices, social links, public contact email) and its latest posts.",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post URLs",
            "type": "array",
            "description": "Links to single posts, like https://name.substack.com/p/post-slug, https://open.substack.com/pub/name/p/post-slug or https://substack.com/@handle/p-123456. Free posts come with full text; paywalled posts with metadata only.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Find newsletters by keyword",
            "type": "array",
            "description": "Uses Substack's public newsletter search. Returns newsletter profile rows in search order (rank). Turn on \"Also scrape posts of found newsletters\" to get their posts too.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Find newsletters by category",
            "type": "array",
            "description": "Substack category leaderboards (the \"Top in ...\" lists). Use the category slug or name, for example technology, business, finance, culture, us-politics, world-politics, food, sports, health, science, history, crypto, education, music, art, fiction, literature, design, climate, parenting, philosophy, travel, faith, humor, comics, fashion, news, international, film-and-tv, games, home-garden, beauty, photography. Subcategory names work too.",
            "items": {
              "type": "string"
            }
          },
          "categoryRanking": {
            "title": "Category ranking",
            "enum": [
              "all",
              "paid"
            ],
            "type": "string",
            "description": "Which leaderboard to read for each category.",
            "default": "all"
          },
          "maxNewslettersPerSearch": {
            "title": "Newsletters per keyword or category",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum newsletters returned for each keyword and each category.",
            "default": 20
          },
          "scrapePostsOfDiscovered": {
            "title": "Also scrape posts of found newsletters",
            "type": "boolean",
            "description": "For newsletters found by keyword or category, also return their posts (using the post settings below). Off: only the newsletter profile rows.",
            "default": false
          },
          "includePosts": {
            "title": "Scrape posts",
            "type": "boolean",
            "description": "Turn off to get only newsletter profile rows.",
            "default": true
          },
          "maxPostsPerNewsletter": {
            "title": "Posts per newsletter",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum posts per newsletter after filters. 0 = the whole archive.",
            "default": 10
          },
          "postSort": {
            "title": "Order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Same as the Latest and Top tabs of the newsletter archive.",
            "default": "new"
          },
          "postSearch": {
            "title": "Only posts matching",
            "type": "string",
            "description": "Optional keyword. Uses the newsletter's own archive search."
          },
          "postType": {
            "title": "Post type",
            "enum": [
              "all",
              "newsletter",
              "podcast",
              "thread"
            ],
            "type": "string",
            "description": "Keep only this kind of post.",
            "default": "all"
          },
          "audience": {
            "title": "Free or paid",
            "enum": [
              "all",
              "free",
              "paid"
            ],
            "type": "string",
            "description": "Filter by paywall status.",
            "default": "all"
          },
          "postedAfter": {
            "title": "Posted after",
            "type": "string",
            "description": "A date (2026-01-31) or a relative period (30 days, 6 months, 1 year). With \"Newest first\" the scan stops at the first older post, so this is fast."
          },
          "postedBefore": {
            "title": "Posted before",
            "type": "string",
            "description": "A date (2026-01-31) or a relative period (30 days)."
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Skip posts with fewer likes (hearts).",
            "default": 0
          },
          "includeFullText": {
            "title": "Full text of free posts",
            "type": "boolean",
            "description": "Adds bodyText (clean plain text, ready for AI) to every free post. Costs one extra request per free post. Never applies to paywalled posts.",
            "default": true
          },
          "includeHtml": {
            "title": "Also include the HTML",
            "type": "boolean",
            "description": "Adds bodyHtml (the original article HTML) to free posts. Makes the dataset much larger.",
            "default": false
          },
          "includeComments": {
            "title": "Public comments",
            "type": "boolean",
            "description": "Adds one row per public comment (with replies, depth and parent) for free posts. Charged per comment.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Comments per post",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum comments per post, replies included. 0 = all.",
            "default": 50
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "best_first",
              "newest_first",
              "oldest_first"
            ],
            "type": "string",
            "description": "Order in which comments are read (and cut off by Comments per post).",
            "default": "best_first"
          },
          "includeNewsletterProfile": {
            "title": "Newsletter profile row",
            "type": "boolean",
            "description": "One row per newsletter in Newsletters with author, description, about text, public subscriber count, paid subscriber range, prices, social links and public contact email. Rows found by keyword or category are always returned.",
            "default": true
          },
          "includeAuthorProfile": {
            "title": "Author social links and followers",
            "type": "boolean",
            "description": "Reads the author's public Substack profile for social links (X, YouTube, LinkedIn, website...), bio and follower count. One extra request per newsletter.",
            "default": true
          },
          "maxItems": {
            "title": "Max results in total",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many result rows (newsletters, posts and comments together). 0 = no limit. The run also stops when your maximum cost per run is reached.",
            "default": 0
          },
          "includeErrorItems": {
            "title": "Explain inputs without results",
            "type": "boolean",
            "description": "Add a free (never charged) row for each input that returned nothing, explaining why (not found, not a Substack site, no matches, blocked).",
            "default": true
          },
          "maxConcurrency": {
            "title": "Inputs in parallel",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many inputs to process at the same time. Requests are rate limited either way.",
            "default": 3
          },
          "maxRequestsPerSecond": {
            "title": "Max requests per second",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Polite request rate across all inputs. Substack rate limits fast clients, so the Actor also slows down by itself (and waits) whenever Substack asks it to.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Usually not needed: the data comes from Substack's public JSON endpoints. Turn on Apify Proxy (datacenter first) only if runs report RATE_LIMITED or BLOCKED. A blocked request switches to a new proxy session automatically.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}