{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Posts, Newsletters, Notes & Leaderboards",
    "description": "Scrape Substack newsletters, posts, comments, Notes and leaderboards. Find newsletters by keyword with subscriber counts, paid prices, posting cadence, sponsors and public contact emails. Track leaderboard growth. No login needed; pay only for results.",
    "version": "0.2",
    "x-build-id": "AdTo9avqh207AkKfi"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tenlakessoftware~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tenlakessoftware-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/tenlakessoftware~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-tenlakessoftware-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/tenlakessoftware~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-tenlakessoftware-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "search",
              "publications",
              "posts",
              "leaderboard",
              "recommendations",
              "profiles",
              "notes"
            ],
            "type": "string",
            "description": "Pick what you want. Search finds newsletters by topic; Publication intelligence gives sponsorship-ready data per newsletter.",
            "default": "search"
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "For mode = Search. Topics like \"AI\", \"personal finance\", \"history\".",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search for",
            "enum": [
              "publications",
              "posts"
            ],
            "type": "string",
            "description": "Find newsletters (with subscriber counts) or individual posts.",
            "default": "publications"
          },
          "publications": {
            "title": "Publications",
            "type": "array",
            "description": "For modes Posts, Publication intelligence, Recommendations. Subdomain (\"lenny\"), substack URL, or custom domain.",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Leaderboard categories",
            "type": "array",
            "description": "For mode = Leaderboards. e.g. \"Technology\", \"Business\", \"Culture\". Empty = all top-level categories.",
            "items": {
              "type": "string"
            }
          },
          "leaderboardType": {
            "title": "Leaderboard",
            "enum": [
              "paid",
              "all"
            ],
            "type": "string",
            "description": "Bestsellers = paid leaderboard. Rising/all = general category leaderboard.",
            "default": "paid"
          },
          "maxRankPerCategory": {
            "title": "Max rank per category",
            "minimum": 1,
            "type": "integer",
            "description": "How many leaderboard positions to collect per category.",
            "default": 100
          },
          "trackGrowth": {
            "title": "Track rank & subscriber growth",
            "type": "boolean",
            "description": "Leaderboards: compare with your previous run and add subscriberChange, rankChange and isNewEntry. Schedule daily or weekly.",
            "default": true
          },
          "handles": {
            "title": "Author handles",
            "type": "array",
            "description": "For modes Profiles / Notes. \"@handle\" or profile URL.",
            "items": {
              "type": "string"
            }
          },
          "enrichPublications": {
            "title": "Add publication intelligence",
            "type": "boolean",
            "description": "Search & Leaderboards: add pricing, posting cadence, sponsors detected and sponsorship signals to every newsletter found (charged as publication intelligence).",
            "default": false
          },
          "sponsorScanPosts": {
            "title": "Recent posts to scan for sponsors",
            "minimum": 0,
            "maximum": 12,
            "type": "integer",
            "description": "Publication intelligence: how many recent free posts to scan for sponsor placements. 0 = skip.",
            "default": 6
          },
          "includeContactEmails": {
            "title": "Include publicly listed contact emails",
            "type": "boolean",
            "description": "Publication intelligence: business contact emails the publication publishes on its own pages (About page, support email). Each email includes its source. Use lawfully (GDPR / CAN-SPAM).",
            "default": false
          },
          "includeBody": {
            "title": "Include full post text",
            "type": "boolean",
            "description": "Posts: full text of free posts (paywalled posts return metadata only).",
            "default": false
          },
          "detectSponsors": {
            "title": "Detect sponsors in posts",
            "type": "boolean",
            "description": "Posts: find sponsor placements (\"Brought to you by…\") and output one sponsor row per brand with link and context.",
            "default": false
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Posts: comment text, threading, likes and replies. Commenter identity is excluded unless enabled below.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 1,
            "type": "integer",
            "description": "Cap on comments collected per post.",
            "default": 100
          },
          "includeCommenterPublications": {
            "title": "Link commenters' own newsletters",
            "type": "boolean",
            "description": "For commenters who run their own Substack, add that publication's name and URL — find engaged creators in a niche.",
            "default": false
          },
          "includeCommenterIdentity": {
            "title": "Include commenter names & handles",
            "type": "boolean",
            "description": "Adds commenter display name and handle. Personal data: you are responsible for lawful use (GDPR).",
            "default": false
          },
          "postedAfter": {
            "title": "Only posts after",
            "type": "string",
            "description": "Posts: stop at older posts."
          },
          "maxItemsPerSource": {
            "title": "Max items per source",
            "minimum": 1,
            "type": "integer",
            "description": "Per publication, author or keyword.",
            "default": 100
          },
          "onlyNew": {
            "title": "Only new since last run",
            "type": "boolean",
            "description": "Return only items you haven't received before. Ideal for scheduled monitoring.",
            "default": false
          },
          "maxItems": {
            "title": "Max total results",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on total results for this run.",
            "default": 1000
          },
          "proxy": {
            "title": "Proxy",
            "type": "object",
            "description": "Proxy settings. Apify Proxy (datacenter) is recommended.",
            "default": {
              "useApifyProxy": true
            }
          },
          "selfTest": {
            "title": "Maintainer self-test",
            "type": "boolean",
            "description": "For the Actor maintainer: runs a health check of all Substack endpoints instead of scraping. Returns no data and charges nothing. Leave off.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}