{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Newsletters, Subscriber Counts & Posts",
    "description": "Scrape Substack newsletters by category leaderboard, keyword or URL: subscriber counts, bestseller rank, paid status, posting cadence, engagement, author socials and website. Plus full post archives with reactions, comments and optional full text. Only-new-posts monitoring. No login. $0.60/1K posts.",
    "version": "1.0",
    "x-build-id": "oBh6ckhNK4eeRiRPl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/wrenfield-data~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-wrenfield-data-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/wrenfield-data~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-wrenfield-data-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/wrenfield-data~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-wrenfield-data-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": [
              "publications",
              "posts",
              "both"
            ],
            "type": "string",
            "description": "Newsletter profiles: one row per newsletter with subscriber count, bestseller tier, leaderboard rank, paid status, posting cadence, average engagement, author socials and website ($2 per 1,000). Posts: one row per post with date, audience, reactions, comments, restacks, word count, tags and preview ($0.60 per 1,000; $1.60 per 1,000 with full text). Both: profiles and posts in one run.",
            "default": "publications"
          },
          "categories": {
            "title": "Category leaderboards",
            "type": "array",
            "description": "Substack categories or subcategories, e.g. Technology, Business, Finance, Culture, Health & Wellness, Crypto, Food & Drink, Sports, Politics, Education. Each leaderboard runs hundreds deep.",
            "items": {
              "type": "string"
            }
          },
          "leaderboard": {
            "title": "Leaderboard type",
            "enum": [
              "paid",
              "all"
            ],
            "type": "string",
            "description": "Bestsellers ranks newsletters by paid subscribers; Top includes free newsletters.",
            "default": "paid"
          },
          "maxPerCategory": {
            "title": "Newsletters per category",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How deep to go into each leaderboard (25 per page).",
            "default": 50
          },
          "searchTerms": {
            "title": "Keywords",
            "type": "array",
            "description": "Find newsletters writing about these topics (Substack search over posts and profiles), e.g. 'AI agents', 'SaaS marketing', 'personal finance'.",
            "items": {
              "type": "string"
            }
          },
          "maxPerSearch": {
            "title": "Newsletters per keyword",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Maximum newsletters to collect for each keyword.",
            "default": 25
          },
          "newsletters": {
            "title": "Newsletter URLs or handles",
            "type": "array",
            "description": "Specific newsletters: https://name.substack.com, custom domains (www.lennysnewsletter.com), subdomains (lenny) or author handles (@lenny).",
            "items": {
              "type": "string"
            }
          },
          "maxPublications": {
            "title": "Max newsletters in total",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on newsletters processed per run, across all sources.",
            "default": 200
          },
          "maxPostsPerNewsletter": {
            "title": "Max posts per newsletter",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Posts mode: how many recent posts to return per newsletter (newest first). Full archives supported.",
            "default": 20
          },
          "postsNewerThanDays": {
            "title": "Only posts from the last N days",
            "minimum": 1,
            "type": "integer",
            "description": "Posts mode: skip older posts (e.g. 7 for a weekly digest)."
          },
          "postsSince": {
            "title": "Only posts since date",
            "type": "string",
            "description": "Posts mode: YYYY-MM-DD. Used when 'last N days' is empty."
          },
          "freePostsOnly": {
            "title": "Free posts only",
            "type": "boolean",
            "description": "Skip paywalled posts.",
            "default": false
          },
          "includeFullText": {
            "title": "Include full post text",
            "type": "boolean",
            "description": "Adds bodyText (clean plain text, ready for AI pipelines) for each post. Paywalled posts return the public preview. $1.60 per 1,000 posts instead of $0.60.",
            "default": false
          },
          "onlyNewPosts": {
            "title": "Only new posts (monitoring)",
            "type": "boolean",
            "description": "Remembers posts returned by earlier runs with the same inputs and returns only new ones. Schedule it daily or weekly.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}