{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper — Posts·Comments·Subscribers w/ EMAILS",
    "description": "Scrape Substack newsletters — full post content, threaded comments, tags, authors, podcast episodes and EXACT subscriber counts. Works with custom domains, date filters, paid-post detection, optional author contact emails. Any publication or post URL. Pure HTTP, JSON/CSV out.",
    "version": "0.0",
    "x-build-id": "2IbJV9lMHcRrKlCbb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/memo23~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-memo23-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/memo23~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-memo23-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/memo23~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-memo23-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 URLs",
            "type": "array",
            "description": "Substack URLs to scrape. Newsletter homepages (https://noahpinion.substack.com or custom domains like https://www.noahpinion.blog), /archive or /about pages, and direct post URLs (https://…/p/some-post) are auto-classified.",
            "items": {
              "type": "string"
            }
          },
          "publications": {
            "title": "Publication shortcuts",
            "type": "array",
            "description": "Bare Substack subdomains or domains — each expands to that publication's homepage. E.g. 'noahpinion' expands to https://noahpinion.substack.com. Used in addition to Start URLs.",
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerNewsletter": {
            "title": "Max posts per newsletter",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of posts to scrape per newsletter. Set to 0 for unlimited (full archive).",
            "default": 50
          },
          "maxItems": {
            "title": "Max posts total",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on post rows across the whole run (all newsletters combined).",
            "default": 1000
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Archive ordering. 'new' = newest first (recommended — enables early stop when combined with Start date). 'top' = most popular first.",
            "default": "new"
          },
          "includeBody": {
            "title": "Include post content (bodyHtml + bodyText)",
            "type": "boolean",
            "description": "Include the full post body as HTML and plain text. Disable for metadata-only scraping — smaller rows, faster runs. Note: paywalled posts return only their free preview portion (flagged via bodyIsPreviewOnly).",
            "default": true
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Fetch comments for each post (one extra API call per post that has comments). Emits one rowType:'comment' row per comment with parentCommentId preserved, joinable to posts via postId.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum comment rows per post, including nested replies. Set to 0 for unlimited. Only applies when 'Include comments' is on.",
            "default": 100
          },
          "includePublicationInfo": {
            "title": "Include publication info",
            "type": "boolean",
            "description": "Emit one rowType:'publication' row per newsletter — name, author (name/handle/bio), description, EXACT free-subscriber count, custom domain, language, created date.",
            "default": true
          },
          "contentType": {
            "title": "Content type",
            "enum": [
              "all",
              "newsletter",
              "podcast",
              "thread"
            ],
            "type": "string",
            "description": "Filter by post type.",
            "default": "all"
          },
          "startDate": {
            "title": "Start date (YYYY-MM-DD)",
            "type": "string",
            "description": "Only posts published on or after this date. With sort order 'Newest first' the scraper stops paginating at the cutoff — fewer API calls, faster and cheaper."
          },
          "endDate": {
            "title": "End date (YYYY-MM-DD)",
            "type": "string",
            "description": "Only posts published on or before this date."
          },
          "onlyFree": {
            "title": "Free posts only",
            "type": "boolean",
            "description": "Skip paywalled posts (audience is 'only_paid' or 'founding'). Paywalled posts otherwise return their free preview portion.",
            "default": false
          },
          "enrichEmails": {
            "title": "Enrich with contact emails (experimental, billed per email)",
            "type": "boolean",
            "description": "Try to find a contact email for each publication/author by discovering their website and reading its contact/about pages. Adds contactEmail + contactWebsite to the publication row plus a detailed emailEnrichment object. Billed per email found — never charged for misses.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "type": "integer",
            "description": "How many posts to process in parallel. Substack's API tolerates moderate parallelism; raise carefully (429s are auto-retried with back-off).",
            "default": 5
          },
          "maxRequestRetries": {
            "title": "Max request retries",
            "minimum": 0,
            "type": "integer",
            "description": "Retries for failed API requests.",
            "default": 5
          },
          "proxy": {
            "title": "Proxy configuration (override)",
            "type": "object",
            "description": "Explicit proxy override. Leave empty to use the actor's built-in residential routing (recommended)."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}