{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper",
    "description": "Substack posts with their likes, comments, restacks and full text, found by keyword across all of Substack or read from the archives of newsletters you name. Comment threads, newsletter details and a new-posts-only mode are there for daily monitoring.",
    "version": "0.1",
    "x-build-id": "MJMCWQfwh9TdWQz3K"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/deriverge~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-deriverge-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/deriverge~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-deriverge-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/deriverge~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-deriverge-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": {
          "searchQueries": {
            "title": "Search Substack by keyword",
            "type": "array",
            "description": "Words or phrases to look up across all of Substack, one per line. Each one returns matching posts with the same fields as newsletter posts, plus the search term and the position in Substack's results. Leave empty to read only the newsletters below.",
            "items": {
              "type": "string"
            }
          },
          "searchSort": {
            "title": "Search order",
            "enum": [
              "top",
              "recent"
            ],
            "type": "string",
            "description": "Top is Substack's main search and includes paid posts and older classics. Recent is Substack's post search: 20 posts per request, and with Published after set it narrows the dates on Substack's side as well.",
            "default": "top"
          },
          "maxPostsPerSearch": {
            "title": "Maximum posts per keyword",
            "minimum": 1,
            "type": "integer",
            "description": "Counted after the filters below. Top search slows down past roughly 200 posts per keyword.",
            "default": 50
          },
          "includeSearchNewsletters": {
            "title": "Include newsletters of found posts",
            "type": "boolean",
            "description": "Add one row per newsletter that published a matching post, with name, author, description, subscriber tier and launch date. Charged as a newsletter row.",
            "default": false
          },
          "newsletters": {
            "title": "Newsletters",
            "type": "array",
            "description": "Substack newsletters to read archives from, in any form: a subdomain such as lenny, a substack.com address, a custom domain or a link to any of their posts. Leave empty to run only the keyword search.",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "title": "Archive order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Newest first is what a monitor wants; most liked first finds the classics.",
            "default": "new"
          },
          "maxPostsPerNewsletter": {
            "title": "Maximum posts per newsletter",
            "minimum": 1,
            "type": "integer",
            "description": "Newest first. Archives go back years, so this is what keeps a broad run affordable.",
            "default": 50
          },
          "publishedAfter": {
            "title": "Published after",
            "type": "string",
            "description": "Drop posts older than this date (YYYY-MM-DD), from newsletters and from search. Dropped posts are never charged."
          },
          "audience": {
            "title": "Audience",
            "enum": [
              "all",
              "free",
              "paid"
            ],
            "type": "string",
            "description": "Substack marks each post as free for everyone or for paying subscribers.",
            "default": "all"
          },
          "keywords": {
            "title": "Keywords (any of)",
            "type": "array",
            "description": "Keep only posts whose title, subtitle, description or preview contain at least one of these words, case-insensitive. Works on newsletter posts and on search results. Dropped posts are never charged.",
            "items": {
              "type": "string"
            }
          },
          "includeBody": {
            "title": "Include post text",
            "type": "boolean",
            "description": "Fetch each post and return its text as plain text and as HTML. Paid posts return the free preview and the row says so. One extra request per post, charged as a post detail.",
            "default": false
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Return the comments under each newsletter post as separate rows with author, date, likes and replies. Search results never include comments. Charged per comment.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Maximum comments per post",
            "minimum": 1,
            "type": "integer",
            "description": "Replies count towards the cap.",
            "default": 100
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "best_first",
              "newest_first",
              "oldest_first"
            ],
            "type": "string",
            "description": "The order Substack returns them in; the cap applies after ordering.",
            "default": "best_first"
          },
          "includeNewsletterInfo": {
            "title": "Include newsletter header",
            "type": "boolean",
            "description": "One row per newsletter in Newsletters with name, author, description, launch date, subscriber tier, language and whether it has paid plans or a podcast. Charged once per newsletter.",
            "default": true
          },
          "newOnly": {
            "title": "Return only rows new since the last run",
            "type": "boolean",
            "description": "Keeps a snapshot per watch name (or per saved task) and returns only posts, comments and newsletters that were not there before. Schedule it daily and you have a new-post alert that bills only for what is new.",
            "default": false
          },
          "watchName": {
            "title": "Watch name",
            "type": "string",
            "description": "Name of the snapshot used by the new-only mode, for example \"my-newsletters\". Runs from a saved task get a snapshot automatically even without a name."
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on returned rows in the run.",
            "default": 10000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}