{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Newsletter Scraper: Posts, Full Text & Leaderboards",
    "description": "Scrape any Substack newsletter: posts with full text in Markdown, likes, comments, authors and paywall status, plus newsletter profiles with subscription prices and category leaderboards. No login needed.",
    "version": "1.0",
    "x-build-id": "ndMh1YsoPEj3WcMLa"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tommyonebig~substack-newsletter-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tommyonebig-substack-newsletter-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/tommyonebig~substack-newsletter-scraper/runs": {
      "post": {
        "operationId": "runs-sync-tommyonebig-substack-newsletter-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/tommyonebig~substack-newsletter-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-tommyonebig-substack-newsletter-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 or post URLs",
            "type": "array",
            "description": "Substack newsletters to scrape. Accepts a handle (<code>lenny</code>), a Substack address (<code>lenny.substack.com</code>), a custom domain (<code>https://www.lennysnewsletter.com</code>) or a single post URL (<code>.../p/post-slug</code>).",
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Leaderboard categories (find newsletters)",
            "type": "array",
            "description": "Discover newsletters from Substack's category leaderboards (e.g. Finance, Technology). Each publication comes with its ranking, author, subscription prices and bestseller tier.",
            "items": {
              "type": "string",
              "enum": [
                "technology",
                "business",
                "finance",
                "culture",
                "us-politics",
                "world-politics",
                "news",
                "science",
                "health",
                "crypto",
                "food",
                "sports",
                "music",
                "art",
                "fashionandbeauty",
                "faith",
                "climate",
                "literature",
                "fiction",
                "design",
                "travel",
                "parenting",
                "philosophy",
                "comics",
                "international",
                "history",
                "humor",
                "education",
                "film-and-tv",
                "home-garden",
                "games",
                "health-politics"
              ],
              "enumTitles": [
                "Technology",
                "Business",
                "Finance",
                "Culture",
                "U.S. Politics",
                "World Politics",
                "News",
                "Science",
                "Health & Wellness",
                "Crypto",
                "Food & Drink",
                "Sports",
                "Music",
                "Art & Illustration",
                "Fashion & Beauty",
                "Faith & Spirituality",
                "Climate & Environment",
                "Literature",
                "Fiction",
                "Design",
                "Travel",
                "Parenting",
                "Philosophy",
                "Comics",
                "International",
                "History",
                "Humor",
                "Education",
                "Film & TV",
                "Home & Garden",
                "Games",
                "Health Politics"
              ]
            }
          },
          "leaderboard": {
            "title": "Leaderboard type",
            "enum": [
              "all",
              "paid"
            ],
            "type": "string",
            "description": "Which Substack leaderboard to read for the selected categories.",
            "default": "all"
          },
          "maxPublicationsPerCategory": {
            "title": "Max publications per category",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many newsletters to take from each category leaderboard.",
            "default": 50
          },
          "maxPostsPerNewsletter": {
            "title": "Max posts per newsletter",
            "minimum": 0,
            "type": "integer",
            "description": "How many posts to collect from each newsletter. Use 0 for the full archive.",
            "default": 20
          },
          "sort": {
            "title": "Order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Newest posts first, or the newsletter's most popular posts first.",
            "default": "new"
          },
          "includeContent": {
            "title": "Include full post text",
            "type": "boolean",
            "description": "Adds the full article body. For paywalled posts only the free preview is available (flagged with contentIsPreview).",
            "default": false
          },
          "contentFormat": {
            "title": "Text format",
            "enum": [
              "markdown",
              "text",
              "html"
            ],
            "type": "string",
            "description": "Format of the post text when 'Include full post text' is on.",
            "default": "markdown"
          },
          "searchQuery": {
            "title": "Search within newsletters",
            "type": "string",
            "description": "Only return posts matching this keyword (uses each newsletter's own archive search)."
          },
          "dateFrom": {
            "title": "Published on or after",
            "type": "string",
            "description": "Only posts published on or after this date."
          },
          "dateTo": {
            "title": "Published on or before",
            "type": "string",
            "description": "Only posts published on or before this date."
          },
          "freeOnly": {
            "title": "Free posts only",
            "type": "boolean",
            "description": "Skip paywalled posts.",
            "default": false
          },
          "postTypes": {
            "title": "Post types",
            "type": "array",
            "description": "Leave empty for all types.",
            "items": {
              "type": "string",
              "enum": [
                "newsletter",
                "podcast",
                "thread"
              ],
              "enumTitles": [
                "Articles",
                "Podcast episodes",
                "Discussion threads"
              ]
            }
          },
          "includePublicationInfo": {
            "title": "Include newsletter profile",
            "type": "boolean",
            "description": "Adds one record per newsletter with author, prices, bestseller tier and creation date.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}