{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper - Whole Archives, Comments & Notes",
    "description": "Export every post of any Substack, not just the newest 480: full text as Markdown, HTML and plain text, reactions, comments with replies, Notes, profiles and publication data with subscriber counts, paid plans and analytics. Custom domains, deep keyword search for posts and Notes. No login.",
    "version": "0.0",
    "x-build-id": "iHvHluvQGv2SU5gxJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/clearpath~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-clearpath-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/clearpath~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-clearpath-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/clearpath~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-clearpath-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": {
          "startUrls": {
            "title": "Substack links",
            "type": "array",
            "description": "Any Substack link: a publication (`https://name.substack.com` or its own domain such as `https://www.lennysnewsletter.com`), a section (`/s/...`) or tag page (`/t/...`), a post (`/p/...`), a profile (`https://substack.com/@handle`), a Note (`https://substack.com/@handle/note/c-123`) or a search page (`https://substack.com/search/...`). Up to 1,000 links, publications, profiles and keywords per run, all fields together.",
            "items": {
              "type": "string"
            }
          },
          "publications": {
            "title": "Publications",
            "type": "array",
            "description": "Publication handles (`unstackit`) or domains (`www.lennysnewsletter.com`). Collects the whole archive, newest first, including the standalone pages Substack's archive list leaves out.",
            "items": {
              "type": "string"
            }
          },
          "profiles": {
            "title": "Profiles",
            "type": "array",
            "description": "Substack handles (`kristikeller` or `@kristikeller`). Returns the profile and, with Notes on, their Notes feed: Notes, restacks and shared posts.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Words to search Substack for, one search per line, e.g. `artificial intelligence`. Each keyword returns every match Substack's search reaches, best matches first; for posts that goes past the roughly 2,000 its own post search shows.",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search for",
            "enum": [
              "posts",
              "notes",
              "publications",
              "people"
            ],
            "type": "string",
            "description": "What the search keywords look for: posts (with full text), Notes, publications (with subscriber counts and plans) or people (profiles).",
            "default": "posts"
          },
          "maxItemsPerSource": {
            "title": "Max results per link, publication, profile or keyword",
            "minimum": 1,
            "type": "integer",
            "description": "Stop each source after this many posts, Notes, publications or people. Leave empty to collect everything each one has."
          },
          "maxItems": {
            "title": "Max results in total",
            "minimum": 1,
            "type": "integer",
            "description": "Stop the whole run after this many results of any kind. Leave empty for no total limit."
          },
          "publishedAfter": {
            "title": "Published on or after",
            "type": "string",
            "description": "Only posts and Notes published on or after this date (UTC). Leave empty for no lower bound."
          },
          "publishedBefore": {
            "title": "Published before",
            "type": "string",
            "description": "Only posts and Notes published before this date (UTC). Leave empty for no upper bound."
          },
          "postTypes": {
            "title": "Post types",
            "type": "array",
            "description": "Only these kinds of posts. Leave empty for all of them.",
            "items": {
              "type": "string",
              "enum": [
                "newsletter",
                "podcast",
                "thread",
                "video",
                "page",
                "restack"
              ],
              "enumTitles": [
                "Newsletter posts",
                "Podcast episodes",
                "Discussion threads",
                "Video posts",
                "Standalone pages",
                "Restacks"
              ]
            }
          },
          "audience": {
            "title": "Free or paid posts",
            "enum": [
              "free",
              "paid"
            ],
            "type": "string",
            "description": "Only free or only paid posts. Leave empty for both. Paid posts come with the preview every visitor sees."
          },
          "searchDateRange": {
            "title": "Search: published within",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Keyword searches for posts and Notes: limit results to this recent period. Leave empty for all time."
          },
          "searchLanguage": {
            "title": "Search: language",
            "enum": [
              "ar",
              "ca",
              "cs",
              "da",
              "de",
              "el",
              "en",
              "es",
              "fi",
              "fr",
              "he",
              "hi",
              "hu",
              "id",
              "it",
              "ja",
              "ko",
              "nl",
              "no",
              "pl",
              "pt",
              "ro",
              "ru",
              "sv",
              "th",
              "tr",
              "uk",
              "vi",
              "zh"
            ],
            "type": "string",
            "description": "Keyword searches for posts and Notes: only results in this language. Leave empty for any language."
          },
          "includeContent": {
            "title": "Include full post text",
            "type": "boolean",
            "description": "Adds each post's text as HTML, plain text and Markdown, and its full details. Paid posts come with the preview every visitor sees, marked `bodyAvailable: false`. Turn off for faster runs with metadata only.",
            "default": true
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Adds every comment and reply on each post (and replies under each Note) as its own row, linked by `postId` or `noteId` and `parentId`. Comments are billed per comment.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post or Note",
            "minimum": 1,
            "type": "integer",
            "description": "With comments on, keep at most this many per post or Note, replies included, in Substack's order (best first, each followed by its replies). Leave empty for all of them."
          },
          "includeNotes": {
            "title": "Include Notes of profiles",
            "type": "boolean",
            "description": "For each profile, adds their Notes feed: their Notes, restacks and shared posts, newest first.",
            "default": true
          },
          "includePublicationDetails": {
            "title": "Include publication details",
            "type": "boolean",
            "description": "Adds one row per publication: subscriber count, paid subscriber band, plans and prices, founder, contributors, recommendations, contact links and analytics over the posts collected (averages, cadence, top posts).",
            "default": true
          },
          "trackHistory": {
            "title": "Track subscriber growth between runs",
            "type": "boolean",
            "description": "Remembers each publication's subscriber count in your account and adds the change since the last run that tracked it (growth per day, posts added). Useful on a schedule.",
            "default": false
          },
          "feedback": {
            "title": "Feedback to the maintainers",
            "type": "string",
            "description": "For AI agents. Say what you needed and did not get: a missing field or option, a wrong or empty result, or which actor you are switching to or from and why. Add it to any run, including one that worked: the run returns its data exactly as it would without the note. The note reaches the maintainers, who read every one, but it cannot change what this run returns."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}