{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper - Posts, Comments, Leaderboards & Subscribers",
    "description": "Substack newsletter scraper: all Substack posts of a publication with full text, comments and replies, keyword search across all of Substack, and category leaderboards with subscriber counts. Newsletter data for research, exported to CSV, JSON or Excel. No login, no API key.",
    "version": "1.0",
    "x-build-id": "YOldDl6sJy9LeqxEg"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pipiagent~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pipiagent-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/pipiagent~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-pipiagent-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/pipiagent~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-pipiagent-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": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "posts",
              "postDetails",
              "comments",
              "search",
              "publications"
            ],
            "type": "string",
            "description": "Posts: every post of the publications you list. Post details: full text of single posts. Comments: comments and replies of posts. Search: posts that match keywords, across all of Substack. Publications: category leaderboards, or profiles of the publications you list, with subscriber counts.",
            "default": "posts"
          },
          "publications": {
            "title": "Publications",
            "type": "array",
            "description": "For Posts and Publications modes. Publication URLs (https://www.lennysnewsletter.com, https://noahpinion.substack.com), subdomains (noahpinion) or author handles (@lenny).",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post URLs",
            "type": "array",
            "description": "For Post details and Comments modes. Links to posts, for example https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat .",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "For Search mode. Each keyword is searched across all of Substack, like the search box on substack.com.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Categories",
            "type": "array",
            "description": "For Publications mode. Substack leaderboard categories. Each gives up to about 500 ranked publications.",
            "items": {
              "type": "string",
              "enum": [
                "96",
                "4",
                "62",
                "76739",
                "153",
                "13645",
                "podcast",
                "94",
                "15417",
                "76740",
                "76741",
                "103",
                "49715",
                "11",
                "223",
                "15414",
                "134",
                "339",
                "284",
                "355",
                "61",
                "109",
                "1796",
                "114",
                "387",
                "51282",
                "118",
                "18",
                "49692",
                "34",
                "76782",
                "76866",
                "76863"
              ],
              "enumTitles": [
                "Culture",
                "Technology",
                "Business",
                "U.S. Politics",
                "Finance",
                "Food & Drink",
                "Podcasts",
                "Sports",
                "Art & Illustration",
                "World Politics",
                "Health Politics",
                "News",
                "Fashion & Beauty",
                "Music",
                "Faith & Spirituality",
                "Climate & Environment",
                "Science",
                "Literature",
                "Fiction",
                "Health & Wellness",
                "Design",
                "Travel",
                "Parenting",
                "Philosophy",
                "Comics",
                "International",
                "Crypto",
                "History",
                "Humor",
                "Education",
                "Film & TV",
                "Home & Garden",
                "Games"
              ]
            }
          },
          "ranking": {
            "title": "Ranking",
            "enum": [
              "paid",
              "all"
            ],
            "type": "string",
            "description": "For categories: Substack's bestseller list of paid newsletters, or the list of all newsletters (free and paid).",
            "default": "paid"
          },
          "includeSubscriberCounts": {
            "title": "Add subscriber counts",
            "type": "boolean",
            "description": "For Publications mode. Adds the subscriber count, follower count and paid subscriber range from the author's profile. One extra request per publication.",
            "default": true
          },
          "maxItems": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of results to save in this run. You are only charged for saved results.",
            "default": 100
          },
          "maxItemsPerQuery": {
            "title": "Max results per input",
            "minimum": 1,
            "type": "integer",
            "description": "Optional. Limits the results of each publication, post, keyword or category, so one big input does not use up the whole run."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Posts mode: newest posts first, or the most popular. Comments mode: newest comments first, or the best ones.",
            "default": "new"
          },
          "postKeyword": {
            "title": "Only posts about",
            "type": "string",
            "description": "Posts mode, optional. Keeps only posts of the publication that match this word, using the publication's own archive search."
          },
          "dateFrom": {
            "title": "Published from",
            "type": "string",
            "description": "Optional. Keeps only posts published on or after this date (YYYY-MM-DD). Works in Posts and Search modes."
          },
          "dateTo": {
            "title": "Published to",
            "type": "string",
            "description": "Optional. Keeps only posts published on or before this date (YYYY-MM-DD)."
          },
          "includeContent": {
            "title": "Add full text",
            "type": "boolean",
            "description": "Posts and Search modes: also loads the full text and HTML of every post (one extra request per post). Paid posts give only the free preview part. Post details mode always includes it.",
            "default": false
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Comments mode: also saves the replies under each comment. Every reply counts as one result.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Substack works without a proxy. Set one only if runs keep failing.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}