{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper – Posts, Comments & Newsletter Stats",
    "description": "Extract Substack newsletter posts (full text or Markdown), comments, publication profiles with subscriber counts and prices, authors, Substack-wide search and category leaderboards. No login. Pay per result: posts from $0.70 per 1,000, no start fee.",
    "version": "0.1",
    "x-build-id": "rQkxXEk7zJYENHZJX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/phantom-x64~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-phantom-x64-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/phantom-x64~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-phantom-x64-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/phantom-x64~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-phantom-x64-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": {
          "publications": {
            "title": "Publications (newsletters)",
            "type": "array",
            "description": "Substack newsletters to scrape: subdomain (astralcodexten), Substack URL (https://lenny.substack.com) or custom domain (https://www.lennysnewsletter.com). You can also paste post URLs (…/p/slug) or profile URLs (substack.com/@handle) here; they are detected automatically.",
            "default": [
              "https://www.astralcodexten.com"
            ],
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post URLs",
            "type": "array",
            "description": "Individual posts: https://<publication>/p/<slug>, https://open.substack.com/pub/<sub>/p/<slug> or https://substack.com/home/post/p-<id>.",
            "items": {
              "type": "string"
            }
          },
          "authors": {
            "title": "Author profiles",
            "type": "array",
            "description": "Substack profiles to read: handle (lenny, @lenny) or URL (https://substack.com/@lenny). Returns subscriber and follower counts, bio, links (X/Twitter, LinkedIn, website...), publications and leaderboard rank.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search queries",
            "type": "array",
            "description": "Search all of Substack, like the search box on substack.com. Returns matching posts (semantic search) and/or people & newsletters, depending on \"Search for\".",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search for",
            "enum": [
              "posts",
              "people",
              "both"
            ],
            "type": "string",
            "description": "\"Posts\" returns matching articles from every publication. \"People & newsletters\" returns writer profiles with their newsletter and subscriber count (great for creator discovery and lead lists). \"Both\" returns both.",
            "default": "posts"
          },
          "maxSearchResults": {
            "title": "Max results per search query",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum posts (and, separately, people) saved per search query.",
            "default": 20
          },
          "leaderboardCategories": {
            "title": "Leaderboard categories",
            "type": "array",
            "description": "Substack leaderboard categories to export, by name, slug or URL: technology, business, finance, culture, us-politics, news, science, health, crypto, sports, food, music, history, fiction... (https://substack.com/leaderboard/technology/paid also works).",
            "items": {
              "type": "string"
            }
          },
          "leaderboardRanking": {
            "title": "Leaderboard ranking",
            "enum": [
              "paid",
              "trending",
              "both",
              "all"
            ],
            "type": "string",
            "description": "\"Bestsellers\" = top paid newsletters, \"Rising\" = fastest-growing (trending) newsletters, \"Top\" = the category directory listing.",
            "default": "paid"
          },
          "maxLeaderboardEntries": {
            "title": "Max entries per leaderboard",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many ranked publications to save per category and ranking (Substack pages them 25 at a time).",
            "default": 25
          },
          "maxPostsPerPublication": {
            "title": "Max posts per publication",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Newest (or top) posts to save per publication after filters. Set 0 to get only the publication profile.",
            "default": 10
          },
          "postSort": {
            "title": "Post order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "\"Newest first\" walks the archive by date. \"Top (most popular) first\" uses Substack's own popularity ranking of the archive.",
            "default": "new"
          },
          "archiveSearch": {
            "title": "Search inside publications",
            "type": "string",
            "description": "Optional keyword: only posts of the given publications that match it (Substack's archive search)."
          },
          "dateFrom": {
            "title": "Oldest post date",
            "type": "string",
            "description": "Only posts published on or after this date. YYYY-MM-DD, an ISO date-time, or relative: \"7 days\", \"2 weeks\", \"6 months\", \"1 year\". Leave empty for no limit."
          },
          "dateTo": {
            "title": "Newest post date",
            "type": "string",
            "description": "Only posts published on or before this date (a plain YYYY-MM-DD includes the whole day). Same formats as the oldest date."
          },
          "audience": {
            "title": "Post audience",
            "enum": [
              "all",
              "free",
              "paid"
            ],
            "type": "string",
            "description": "Keep all posts, only free (public) posts, or only paywalled posts. For paywalled posts only the free preview that Substack shows to everyone is returned.",
            "default": "all"
          },
          "includeContent": {
            "title": "Include full post content",
            "type": "boolean",
            "description": "Fetch the post body (one extra request per post). Off = metadata only (title, date, likes, comments count, authors...), which is cheaper.",
            "default": true
          },
          "contentFormats": {
            "title": "Content formats",
            "type": "array",
            "description": "Formats of the post body: clean plain text, Markdown (best for AI / RAG / LLM pipelines) and/or the original HTML.",
            "items": {
              "type": "string",
              "enum": [
                "text",
                "markdown",
                "html"
              ],
              "enumTitles": [
                "Plain text",
                "Markdown",
                "HTML"
              ]
            },
            "default": [
              "text",
              "markdown"
            ]
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Also save the public comments (with replies) of every post. Comments on paid-only posts are not public and are skipped.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum comments (including replies) saved per post.",
            "default": 100
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "best_first",
              "most_recent_first",
              "oldest_first"
            ],
            "type": "string",
            "description": "Order in which comments are read (matters when the max comments limit cuts the list).",
            "default": "best_first"
          },
          "includePublicationInfo": {
            "title": "Include publication profile",
            "type": "boolean",
            "description": "Add one row per publication with name, author, subscriber count, paid plans and prices, bestseller tier, podcast, sections and contributors.",
            "default": true
          },
          "onlyNewPosts": {
            "title": "Only new posts since the last run (monitor mode)",
            "type": "boolean",
            "description": "Remembers the newest post date of every publication and, on the next run, returns only newer posts. Ideal for scheduled runs: you never pay twice for the same post.",
            "default": false
          },
          "monitorStateKey": {
            "title": "Monitor name",
            "type": "string",
            "description": "Name of the saved monitor state. Use a different name for each independent monitor or schedule. Only used in monitor mode.",
            "default": "default"
          },
          "maxConcurrency": {
            "title": "Inputs in parallel",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many publications / searches / categories are processed at the same time.",
            "default": 3
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 0,
            "maximum": 30000,
            "type": "integer",
            "description": "Minimum pause between two requests of the same input, in milliseconds (a small random jitter is added). Raise it if you see HTTP 429 warnings.",
            "default": 300
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How many times a failed request (network error, HTTP 429/5xx or anti-bot page) is retried with a new proxy session and exponential backoff.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify Proxy spreads requests over many IPs and avoids rate limits on big runs. Datacenter proxies are usually enough for Substack.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}