{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Posts, Newsletters & Leaderboards",
    "description": "Scrape Substack posts with full text, likes, comments and dates. Find newsletters by keyword with subscriber counts, author and bio, or pull Top overall and Top paid category leaderboards. No login, no browser. $1 per 1,000 results.",
    "version": "0.0",
    "x-build-id": "MFHjwRBVeHNgCtzhj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgedata~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgedata-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/forgedata~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-forgedata-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/forgedata~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-forgedata-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": {
          "mode": {
            "title": "What to collect",
            "enum": [
              "posts",
              "search",
              "category"
            ],
            "type": "string",
            "description": "Posts from the newsletters you list, newsletters matching your keywords, or the top newsletters in Substack's category leaderboards.",
            "default": "posts"
          },
          "publications": {
            "title": "Newsletters",
            "type": "array",
            "description": "Newsletter addresses, e.g. https://www.lennysnewsletter.com, astralcodexten.substack.com, or just the name before .substack.com (astralcodexten).",
            "default": [
              "https://www.lennysnewsletter.com",
              "https://newsletter.pragmaticengineer.com"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerPublication": {
            "title": "Max posts per newsletter",
            "minimum": 1,
            "type": "integer",
            "description": "Newest posts first.",
            "default": 50
          },
          "postsSince": {
            "title": "Posts since",
            "type": "string",
            "description": "Only posts published on or after this date."
          },
          "freePostsOnly": {
            "title": "Free posts only",
            "type": "boolean",
            "description": "Skip paid-subscriber posts.",
            "default": false
          },
          "includeContent": {
            "title": "Include post text",
            "type": "boolean",
            "description": "Add the full text of free posts. For paid posts only the free preview shown before the paywall is included.",
            "default": false
          },
          "searchQueries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Find newsletters whose name, description, author or author bio mention any of these words, e.g. artificial intelligence, personal finance, recruiting, real estate. Searches the top newsletters in Substack's category leaderboards (about 16,000).",
            "default": [
              "artificial intelligence"
            ],
            "items": {
              "type": "string"
            }
          },
          "searchInCategories": {
            "title": "Search only these categories",
            "type": "array",
            "description": "Optional. Limit keyword search to these categories (e.g. technology, business, finance) for a faster run. Empty means all categories.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "categories": {
            "title": "Categories",
            "type": "array",
            "description": "Substack categories: technology, business, finance, culture, us-politics, world-politics, news, science, health, sports, food, music, art, fashionandbeauty, faith, climate, literature, fiction, design, travel, parenting, philosophy, comics, crypto, history, humor, education, film-and-tv, home-garden, games, international.",
            "default": [
              "technology"
            ],
            "items": {
              "type": "string"
            }
          },
          "leaderboard": {
            "title": "Leaderboard",
            "enum": [
              "all",
              "paid"
            ],
            "type": "string",
            "description": "Top overall or top by paid subscribers. Used by keyword search and category modes. Each category lists up to about 500 newsletters.",
            "default": "all"
          },
          "minSubscribers": {
            "title": "Minimum subscribers",
            "minimum": 0,
            "type": "integer",
            "description": "Only newsletters showing at least this many subscribers. 0 means no minimum.",
            "default": 0
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Only newsletters in this language code, e.g. en, es, de, fr, pt. Leave empty for all.",
            "default": ""
          },
          "includeLatestPosts": {
            "title": "Also get latest posts per newsletter",
            "minimum": 0,
            "type": "integer",
            "description": "For search and category modes: also collect this many recent posts from each newsletter found. 0 means newsletters only.",
            "default": 0
          },
          "maxItems": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after saving this many newsletters and posts in total. You pay only for results saved.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}