{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper – Export Posts, Newsletter Archives & Search",
    "description": "Substack scraper & unofficial Substack API: export all posts from any newsletter archive, single posts or keyword search. Full text (HTML/Markdown), likes, comments, restacks, author & publication data. Export to JSON, CSV, Excel. No login.",
    "version": "1.0",
    "x-build-id": "bZ6naiU3arWB1dTRA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapeworkshq~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapeworkshq-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/scrapeworkshq~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapeworkshq-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/scrapeworkshq~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapeworkshq-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": "Newsletter URLs, custom domains or bare subdomains, e.g. https://www.lennysnewsletter.com, astralcodexten, platformer.news. Post URLs here also work.",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post URLs",
            "type": "array",
            "description": "Individual post URLs (…/p/slug).",
            "items": {
              "type": "string"
            }
          },
          "searchKeywords": {
            "title": "Search keywords",
            "type": "array",
            "description": "Search all public Substack posts by keyword (Substack's own search).",
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerPublication": {
            "title": "Max posts per publication",
            "minimum": 0,
            "type": "integer",
            "description": "0 = full archive.",
            "default": 50
          },
          "maxSearchResultsPerKeyword": {
            "title": "Max search results per keyword",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Posts per keyword.",
            "default": 20
          },
          "maxPostsTotal": {
            "title": "Max posts total",
            "minimum": 0,
            "type": "integer",
            "description": "Hard cap across the whole run (cost control). 0 = no cap.",
            "default": 0
          },
          "dateFrom": {
            "title": "Published from",
            "type": "string",
            "description": "Only posts on/after this date (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Published to",
            "type": "string",
            "description": "Only posts on/before this date (YYYY-MM-DD)."
          },
          "postTypes": {
            "title": "Post types",
            "type": "array",
            "description": "Empty = all types.",
            "items": {
              "type": "string",
              "enum": [
                "newsletter",
                "podcast",
                "thread"
              ],
              "enumTitles": [
                "Newsletter",
                "Podcast",
                "Thread"
              ]
            }
          },
          "onlyFree": {
            "title": "Only free posts",
            "type": "boolean",
            "description": "Skip paywalled posts entirely (otherwise they are returned with metadata and isPaywalled=true).",
            "default": false
          },
          "bodyFormat": {
            "title": "Post body",
            "enum": [
              "none",
              "html",
              "markdown",
              "text",
              "all"
            ],
            "type": "string",
            "description": "Full body of free posts. Paywalled bodies are never collected.",
            "default": "none"
          },
          "includeReactions": {
            "title": "Include reactions breakdown",
            "type": "boolean",
            "description": "Per-emoji reaction counts (reactionCount, commentCount and restacks are always included).",
            "default": true
          },
          "includePublicationMetadata": {
            "title": "Include publication metadata",
            "type": "boolean",
            "description": "Name, author, description, public subscriber-count text, sections/categories, logo. One extra request per publication.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Parallel requests. Keep low to be polite.",
            "default": 4
          },
          "maxRequestsPerMinute": {
            "title": "Max requests per minute",
            "minimum": 10,
            "maximum": 600,
            "type": "integer",
            "description": "Global rate limit.",
            "default": 90
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Usually not needed. Enable if you hit rate limits (HTTP 429).",
            "default": {
              "useApifyProxy": false
            }
          },
          "monitorMode": {
            "title": "Monitor mode (track changes across runs)",
            "enum": [
              "off",
              "all",
              "changes",
              "onlyNew"
            ],
            "type": "string",
            "description": "Remembers items from previous runs (per Monitor key) and adds changeType = new/changed/unchanged plus a field-level diff. In the two 'only' modes, unchanged/old items are not output and not charged.",
            "default": "off"
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Name of the memory used by Monitor mode. Use a different key per schedule/task (e.g. 'daily-pokemon'), so separate watchlists don't mix.",
            "default": "default"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "full",
              "flat"
            ],
            "type": "string",
            "description": "Flat makes CSV/Excel/Google Sheets exports one clean column per field.",
            "default": "full"
          },
          "summaryWebhookUrl": {
            "title": "Summary webhook URL (optional)",
            "type": "string",
            "description": "At the end of the run, POST a compact JSON summary (counts, new/changed, price drops, dataset ID) to this URL – e.g. Zapier/Make/n8n catch hook or Slack workflow. Free."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}