{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper: Newsletter Posts, Search & Leaderboards",
    "description": "Scrape Substack newsletters: posts from any publication (archive, top posts, full text), Substack-wide post search and category leaderboards (bestseller and rising newsletters with paid tier, subscribers, prices and author). No login, no API key.",
    "version": "0.1",
    "x-build-id": "GgjuHydPGdYdYqHDN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datadesk-io~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datadesk-io-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/datadesk-io~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-datadesk-io-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/datadesk-io~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-datadesk-io-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": "Newsletters (publications)",
            "type": "array",
            "description": "Substack newsletters to scrape: subdomain (lenny), substack.com address (lenny.substack.com), custom domain or URL (https://www.lennysnewsletter.com) or an author @handle (@lenny). Leave everything empty to get the latest posts of 2 sample newsletters.",
            "items": {
              "type": "string"
            }
          },
          "postUrls": {
            "title": "Post URLs (optional)",
            "type": "array",
            "description": "Single posts to scrape with full text, e.g. https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat. Paid posts return only the free preview.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search Substack posts (optional)",
            "type": "array",
            "description": "Keywords to search across all of Substack (the same search as substack.com). Returns matching posts with their newsletter, author and engagement.",
            "items": {
              "type": "string"
            }
          },
          "leaderboardCategories": {
            "title": "Leaderboard categories (optional)",
            "type": "array",
            "description": "Substack leaderboard categories to list newsletters from: technology, business, finance, culture, us-politics, world-politics, news, science, health, food, sports, music, art, crypto, education, history, fiction, literature, design, travel, parenting, philosophy, faith, climate, comics, humor, games, film-and-tv, fashionandbeauty, home-garden, international. One row per newsletter (rank, paid tier, subscribers, prices, author).",
            "items": {
              "type": "string"
            }
          },
          "leaderboardType": {
            "title": "Leaderboard type",
            "enum": [
              "paid",
              "trending"
            ],
            "type": "string",
            "description": "Which Substack leaderboard to read for the categories above.",
            "default": "paid"
          },
          "maxPostsPerSource": {
            "title": "Max results per source",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap per newsletter, per search query and per leaderboard category. Newsletter archives are read 50 posts per page until this cap, the date limit or the first post.",
            "default": 25
          },
          "sort": {
            "title": "Newsletter post order",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Order of newsletter archive posts: newest first or Substack's 'top' (most popular) order.",
            "default": "new"
          },
          "includeContent": {
            "title": "Include full post text",
            "type": "boolean",
            "description": "Add the full post body (plain text and HTML) to every post. Costs one extra request per post (slower), same price. Paid posts only include the free preview part.",
            "default": false
          },
          "postedAfter": {
            "title": "Only posts after (optional)",
            "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])(T.*)?$",
            "type": "string",
            "description": "Skip posts older than this date (YYYY-MM-DD, UTC). With 'Newest first' the archive stops at the date, so older posts are never fetched or charged. Great for daily monitoring."
          },
          "maxResults": {
            "title": "Max results in total",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on rows (posts + publications) for the whole run. Never exceeded."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}