{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper — Posts, Comments, Notes & Search",
    "description": "Substack scraper and API: full posts, comments, Notes, keyword search, leaderboards and subscriber counts. Only-new-posts mode for schedules. JSON, CSV, Excel.",
    "version": "0.2",
    "x-build-id": "TyfE4KhYpcsxJTf9S"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/innolabs~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-innolabs-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/innolabs~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-innolabs-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/innolabs~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-innolabs-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",
            "type": "array",
            "description": "Substack newsletters to scrape: subdomains (on, lenny), hosts (on.substack.com, www.lennysnewsletter.com) or full URLs. Duplicates and aliases of the same publication are scraped once.",
            "items": {
              "type": "string"
            }
          },
          "includePosts": {
            "title": "Include posts",
            "type": "boolean",
            "description": "Emit one dataset item per post with full bodyHtml, bodyText, authors, reactions and comment count.",
            "default": true
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Emit one dataset item per comment, including nested replies (parentId and depth preserved). Applies to publication posts and to posts found by search.",
            "default": false
          },
          "maxPostsPerPublication": {
            "title": "Max posts per publication",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many posts to collect from each publication. Comments are fetched for these posts only. With a query, matching posts are collected up to this number (the actor scans at most 500 posts looking for matches).",
            "default": 50
          },
          "query": {
            "title": "Filter posts by keyword",
            "type": "string",
            "description": "Optional case-insensitive filter on post title or body text inside the publications above. To search all of Substack, use Search keywords instead.",
            "default": ""
          },
          "sort": {
            "title": "Archive order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Order used for the archive: newest first, or the publication's top posts.",
            "default": "new"
          },
          "onlyNewPosts": {
            "title": "Only new posts (incremental)",
            "type": "boolean",
            "description": "Push only posts that previous runs have not delivered. The actor remembers the newest post per publication (and the results seen per search keyword) in a named key-value store, so a daily schedule outputs just the new posts. The first run delivers posts normally and saves the state.",
            "default": false
          },
          "stateName": {
            "title": "State name",
            "type": "string",
            "description": "Keeps separate 'already seen' memory for different schedules or tasks. Letters, digits, '-' and '_' only. Change it to start fresh.",
            "default": "default"
          },
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Keywords or phrases searched across all of Substack, e.g. 'climate tech' or 'AI agents'. Each keyword is searched separately.",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search for",
            "enum": [
              "posts",
              "publications"
            ],
            "type": "string",
            "description": "Return matching posts (full post bodies, billed per post) or matching publications (newsletter profiles with subscriber counts, billed per publication).",
            "default": "posts"
          },
          "maxSearchResults": {
            "title": "Max results per keyword",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many posts or publications to return for each keyword.",
            "default": 50
          },
          "leaderboardCategories": {
            "title": "Leaderboard categories",
            "type": "array",
            "description": "Category slugs or names (technology, business, culture, finance, us-politics, ...) or leaderboard URLs such as https://substack.com/leaderboard/technology/paid.",
            "items": {
              "type": "string"
            }
          },
          "leaderboardType": {
            "title": "Leaderboard",
            "enum": [
              "paid",
              "trending"
            ],
            "type": "string",
            "description": "Bestsellers (ranked by paid subscribers) or Rising (fastest-growing). A leaderboard URL in the list above overrides this.",
            "default": "paid"
          },
          "maxPublicationsPerLeaderboard": {
            "title": "Max publications per leaderboard",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many ranked publications to return per category. Substack leaderboards list up to 100.",
            "default": 100
          },
          "noteProfiles": {
            "title": "Notes authors",
            "type": "array",
            "description": "Writers whose Notes to collect: @handle, handle, https://substack.com/@handle or https://substack.com/profile/<id>-<name>.",
            "items": {
              "type": "string"
            }
          },
          "maxNotesPerProfile": {
            "title": "Max notes per author",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "How many of each writer's most recent Notes to collect.",
            "default": 50
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on dataset items across all item types. The run stops cleanly when reached.",
            "default": 1000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify Proxy settings. Use a proxy if Substack rate-limits or blocks the actor's IP.",
            "default": {
              "useApifyProxy": true
            }
          },
          "debug": {
            "title": "Debug logging",
            "type": "boolean",
            "description": "Log per-publication progress and diagnostics.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}